Skip to content

Commit

Permalink
test shared-internals on node 12 without volta
Browse files Browse the repository at this point in the history
  • Loading branch information
mansona committed Oct 23, 2023
1 parent 65229b3 commit 4ddb102
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions tests/scenarios/shared-internals-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,25 @@ 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({
'.npmrc': 'use-node-version=12.22.1',
'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");
Expand All @@ -39,14 +37,7 @@ Scenarios.fromProject(() => new Project('shared-internals-tests'))
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/qunit/bin/qunit.js ./test.js`);
let result = await app.execute(`pnpm ./node_modules/qunit/bin/qunit.js ./test.js`);
assert.equal(result.exitCode, 0, result.output);
});
});
Expand Down

0 comments on commit 4ddb102

Please sign in to comment.