Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion tests/bundle-cmd.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,10 @@ test('CLI: bundle load surfaces ERR_MODULE_NOT_FOUND for dynamic import of a mis
t.assert.equal(build.status, 0, `bundle stderr: ${build.stderr}`)

// cjsFixture ships a stasis.lock.json; use lock=ignore so `stasis run` tolerates it.
// The fixture's stasis.config.json declares scope=full, which is now the CLI default
// since ed41d6f flipped --full into the implicit default. No scope flag needed.
const load = runCli(
['run', '--lock=ignore', '--full', '--bundle=load', `--bundle-file=${bundlePath}`, 'src/entry.cjs'],
['run', '--lock=ignore', '--bundle=load', `--bundle-file=${bundlePath}`, 'src/entry.cjs'],
{ cwd: tmp },
)
t.assert.equal(load.status, 0, `load stderr: ${load.stderr}`)
Expand Down
14 changes: 8 additions & 6 deletions tests/popular-npm-modules.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ describe('static bundle (stasis bundle) on the 10-package set', { concurrency: t
t.assert.ok(decoded.imports['*'], `static bundle should record imports under '*'; got ${Object.keys(decoded.imports).join(', ')}`)

const load = await run(
['run', '--lock=none', '--bundle=load', `--bundle-file=${bundlePath}`, 'src/entry.js'],
['run', '--lock=none', '--dependencies', '--bundle=load', `--bundle-file=${bundlePath}`, 'src/entry.js'],
{ cwd: tmp },
)
t.assert.equal(load.status, 0, `load stderr: ${load.stderr}`)
Expand Down Expand Up @@ -456,7 +456,7 @@ describe('static bundle (stasis bundle) on the 10-package set', { concurrency: t
await writeFile(staticPath, staticBundleBuf)

const fromStatic = await run(
['run', '--lock=none', '--bundle=load', `--bundle-file=${staticPath}`, 'src/entry.js'],
['run', '--lock=none', '--dependencies', '--bundle=load', `--bundle-file=${staticPath}`, 'src/entry.js'],
{ cwd: tmp },
)
t.assert.equal(fromStatic.status, 0, `static stderr: ${fromStatic.stderr}`)
Expand All @@ -478,7 +478,7 @@ describe('static bundle (stasis bundle) on the 10-package set', { concurrency: t
await writeFile(join(tmp, 'stasis.lock.json'), staticLockText)

const r = await run(
['run', '--lock=frozen', '--bundle=load', `--bundle-file=${bundlePath}`, 'src/entry.js'],
['run', '--lock=frozen', '--dependencies', '--bundle=load', `--bundle-file=${bundlePath}`, 'src/entry.js'],
{ cwd: tmp },
)
t.assert.equal(r.status, 0, `stderr: ${r.stderr}`)
Expand Down Expand Up @@ -522,14 +522,14 @@ describe('static bundle (stasis bundle) on the 10-package set', { concurrency: t

// Each entry independently loads against the same bundle.
const load1 = await run(
['run', '--lock=none', '--full', '--bundle=load', `--bundle-file=${bundlePath}`, 'src/entry.js'],
['run', '--lock=none', '--bundle=load', `--bundle-file=${bundlePath}`, 'src/entry.js'],
{ cwd: tmp },
)
t.assert.equal(load1.status, 0, `load entry stderr: ${load1.stderr}`)
t.assert.equal(load1.stdout, expectedOutput)

const load2 = await run(
['run', '--lock=none', '--full', '--bundle=load', `--bundle-file=${bundlePath}`, 'src/entry2.js'],
['run', '--lock=none', '--bundle=load', `--bundle-file=${bundlePath}`, 'src/entry2.js'],
{ cwd: tmp },
)
t.assert.equal(load2.status, 0, `load entry2 stderr: ${load2.stderr}`)
Expand Down Expand Up @@ -568,7 +568,9 @@ describe('lock x bundle matrix with statically-built bundle', { concurrency: tru
if (seedLock) await writeFile(lockPath, seedText)
if (seedBundle) await writeFile(bundlePath, staticBundleBuf)

const args = ['run', `--lock=${lock}`, `--bundle=${bundle}`]
// Fixture is node_modules-scoped; --dependencies opts back into that since
// ed41d6f flipped `stasis run`'s default scope to 'full'.
const args = ['run', `--lock=${lock}`, '--dependencies', `--bundle=${bundle}`]
if (bundle !== 'none') args.push(`--bundle-file=${bundlePath}`)
args.push('src/entry.js')

Expand Down
9 changes: 7 additions & 2 deletions tests/scan.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ function flattenImports(imports) {
function captureRuntimeBundle(fixture, entry, tmp, { full = false } = {}) {
const bundlePath = join(tmp, 'snapshot.br')
const args = ['run', '--lock=add', '--bundle=add', `--bundle-file=${bundlePath}`]
if (full) args.push('--full')
// ed41d6f flipped `stasis run`'s default to scope=full; --dependencies is the
// node_modules-only opt-in. The two fixtures have explicit scope in their
// stasis.config.json (cli-run-cjs: full, cli-run-nm-cjs: node_modules), so
// pass --dependencies for the nm-scoped one to avoid env-vs-file conflict.
if (!full) args.push('--dependencies')
args.push(entry)
const r = runCli(args, { cwd: fixture })
if (r.status !== 0) throw new Error(`stasis run failed: ${r.stderr}`)
Expand Down Expand Up @@ -245,8 +249,9 @@ test('stasis bundle of module-sync package executes the same code as plain Node'
const bundlePath = join(tmp, 'snap.br')
const build = runCli(['bundle', `--scope=full`, `--output=${bundlePath}`, 'src/entry.js'], { cwd: tmp })
t.assert.equal(build.status, 0, `bundle stderr: ${build.stderr}`)
// ed41d6f made scope=full the default; no flag needed.
const load = runCli(
['run', '--lock=none', '--full', '--bundle=load', `--bundle-file=${bundlePath}`, 'src/entry.js'],
['run', '--lock=none', '--bundle=load', `--bundle-file=${bundlePath}`, 'src/entry.js'],
{ cwd: tmp },
)
t.assert.equal(load.status, 0, `load stderr: ${load.stderr}`)
Expand Down