Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore older node support #1528

Merged
merged 2 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion tests/scenarios/core-resolver-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ Scenarios.fromProject(() => new Project())
'app.js': `import "rsvp"`,
});
await configure({});
expectAudit.module('./app.js').resolves('rsvp').to(resolve('/@embroider/external/rsvp').replaceAll(sep, '/'));
expectAudit.module('./app.js').resolves('rsvp').to(resolve('/@embroider/external/rsvp').split(sep).join('/'));
});

test(`known ember-source-provided virtual packages are not externalized when explicitly included in deps`, async function () {
Expand Down
53 changes: 53 additions & 0 deletions tests/scenarios/shared-internals-test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import QUnit from 'qunit';
import { Project, Scenarios } from 'scenario-tester';

const { module: Qmodule, test } = QUnit;

Scenarios.fromProject(() => new Project('shared-internals-tests'))
.map('shared-internals', project => {
project.pkg.volta = {
node: '12.22.1',
};
project.linkDependency('@embroider/shared-internals', { baseDir: __dirname });
project.linkDependency('qunit', { baseDir: __dirname });
project.linkDependency('semver', { baseDir: __dirname });

project.mergeFiles({
'test.js': `
const { module: QModule, test } = require("qunit");
const semver = require("semver");
const { PackageCache } = require("@embroider/shared-internals");

QModule("shared-internals", function () {
test("testing on node 12", function (assert) {
assert.ok(
semver.satisfies(process.version, "^12.0.0"),
\`\${process.version} should be what we expected\`
);
});

test("smoke test", async function (assert) {
let pk = PackageCache.shared("my-test", __dirname);
assert.equal(pk.get(__dirname).name, "shared-internals-tests");
});
});
`,
});
})
.forEachScenario(scenario => {
Qmodule(scenario.name, function () {
test('run tests', async function (assert) {
let app = await scenario.prepare();

// if we just try to invoke node directly in a child process, our own
// volta settings dominate over the test app's
let tryit = await app.execute('volta which node');
if (tryit.exitCode !== 0) {
throw new Error('unable to locate our node version');
}
let nodebin = tryit.output.trim();
let result = await app.execute(`${nodebin} ./node_modules/.bin/qunit ./test.js`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider my mind blown

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Volta is pretty good at keeping you inside its little fence. Need to be tricky if you actually want to get out like this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe there's actually real Volta public API for doing this in a way that doesn't need tricks...

assert.equal(result.exitCode, 0, result.output);
});
});
});
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"./tests/scenarios/**/*.ts"
],
"compilerOptions": {
"target": "es2021",
"target": "es2019",
"module": "commonjs",
"declaration": true,
"typeRoots": ["types", "node_modules/@types"],
Expand Down
Loading