Skip to content

Commit

Permalink
Skip ExperimentalWarning
Browse files Browse the repository at this point in the history
  • Loading branch information
kmalakoff committed Feb 22, 2024
1 parent d47b035 commit 66fc0e3
Show file tree
Hide file tree
Showing 9 changed files with 201 additions and 50 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node: ['20']
node: [latest]
os: [ubuntu-latest, windows-latest]
# os: [ubuntu-latest, windows-latest, macos-latest]
steps:
Expand All @@ -24,4 +24,5 @@ jobs:
- run: npm ci
- run: npm run version
- run: npm run build
- run: npm run test
- run: npm run test:engines
2 changes: 1 addition & 1 deletion dist/cjs/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var _default = function(argv, name) {
};
options.stdio = "inherit"; // pass through stdio
(0, _index.default)(args[0], args[1], args.slice(2), options, function(err, results) {
if (err) {
if (err && err.message.indexOf("ExperimentalWarning") < 0) {
console.log(err.message);
return (0, _exit.default)(err.code || -1);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/cjs/cli.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 27 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"depcheck": "^1.4.7",
"is-version": "^0.2.1",
"rimraf": "^2.7.1",
"ts-dev-stack": "^0.14.9"
"ts-dev-stack": "^0.15.1"
},
"engines": {
"node": ">=0.8"
Expand Down
2 changes: 1 addition & 1 deletion src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default (argv, name) => {

options.stdio = 'inherit'; // pass through stdio
nvu(args[0], args[1], args.slice(2), options, (err, results) => {
if (err) {
if (err && err.message.indexOf('ExperimentalWarning') < 0) {
console.log(err.message);
return exit(err.code || -1);
}
Expand Down
24 changes: 9 additions & 15 deletions test/spec/versions.test.js → test/spec/callback.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ const OPTIONS = {
cacheDirectory: path.join(TMP_DIR, 'cache'),
installDirectory: path.join(TMP_DIR, 'installed'),
buildDirectory: path.join(TMP_DIR, 'build'),
now: now,
now: now, // BE CAREFUL - this fixes a moment in time
encoding: 'utf8',
silent: true,
};

describe('versions', () => {
describe('callback', () => {
before((callback) => {
rimraf(TMP_DIR, callback.bind(null, null));
});
Expand Down Expand Up @@ -86,22 +86,16 @@ describe('versions', () => {
});
});

describe('promise', () => {
if (typeof Promise === 'undefined') return; // no promise support

it('using engines - 12 (promise)', (done) => {
const cwd = path.resolve(path.join(__dirname, '..', 'data', 'engines'));
versionUse('engines', NODE, ['--version'], Object.assign({ cwd: cwd }, OPTIONS))
.then((results) => {
assert.ok(results.length > 0);
assert.ok(versionLines(results[0].result.stdout).slice(-1)[0].indexOf('v12.') === 0);
done();
})
.catch(done);
it('>=8', (done) => {
versionUse('>=8', NODE, ['--version'], Object.assign({ range: 'major,even' }, OPTIONS), (err, results) => {
assert.ok(!err);
assert.ok(results.length > 0);
assert.ok(versionLines(results[0].result.stdout).slice(-1)[0].indexOf('v8.') === 0);
done();
});
});

describe('contants', () => {
describe('constants', () => {
it('installDirectory', () => {
const installDirectory = versionUse.installDirectory();
assert.ok(installDirectory);
Expand Down
10 changes: 10 additions & 0 deletions test/spec/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ describe('cli', () => {
done();
});
});

it('>=8', (done) => {
const cwd = path.resolve(path.join(__dirname, '..', 'data', 'engines'));
spawn(CLI, ['>=8', NODE, '--version'], { encoding: 'utf8', cwd: cwd }, (err, res) => {
assert.ok(!err);
console.log(res.stdout)
assert.ok(versionLines(res.stdout).slice(0)[0].indexOf('v8.') === 0);
done();
});
});
});

describe('unhappy path', () => {
Expand Down
Loading

0 comments on commit 66fc0e3

Please sign in to comment.