Skip to content

Commit

Permalink
Merge pull request #1655 from embroider-build/fix-util-node-version
Browse files Browse the repository at this point in the history
fix node version for @embroider/util
  • Loading branch information
mansona authored Nov 10, 2023
2 parents 6d4a757 + 2517f2a commit 80e325d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
11 changes: 1 addition & 10 deletions packages/util/ember-cli-build.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');
const { maybeEmbroider } = require('@embroider/test-setup');

module.exports = function (defaults) {
let app = new EmberAddon(defaults, {
Expand All @@ -15,13 +14,5 @@ module.exports = function (defaults) {
behave. You most likely want to be modifying `./index.js` or app's build file
*/

return maybeEmbroider(app, {
staticAddonTrees: true,
staticAddonTestSupportTrees: true,
skipBabel: [
{
package: 'qunit',
},
],
});
return app.toTree();
};
2 changes: 1 addition & 1 deletion packages/util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"webpack": "^5.74.0"
},
"engines": {
"node": "14.* || >= 16"
"node": "12.* || 14.* || >= 16"
},
"ember": {
"edition": "octane"
Expand Down
26 changes: 25 additions & 1 deletion tests/scenarios/util-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,38 @@ import { dirname } from 'path';
const { module: Qmodule, test } = QUnit;

supportMatrix(Scenarios.fromDir(dirname(require.resolve('@embroider/util/package.json'))))
.map('util', () => {})
.only('lts_3_28')
.map('util', project => {
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\`
);
});
});
`,
});
})
.forEachScenario(scenario => {
Qmodule(scenario.name, function (hooks) {
let app: PreparedApp;
hooks.before(async () => {
app = await scenario.prepare();
});

test('verify node version', async function (assert) {
let result = await app.execute(`pnpm ./node_modules/qunit/bin/qunit.js ./test.js`);
assert.equal(result.exitCode, 0, result.output);
});

test(`pnpm test:ember`, async function (assert) {
let result = await app.execute('pnpm test:ember');
assert.equal(result.exitCode, 0, result.output);
Expand Down

0 comments on commit 80e325d

Please sign in to comment.