Skip to content

Commit

Permalink
fix windows (#442)
Browse files Browse the repository at this point in the history
* fix windows

* polish
  • Loading branch information
aeschli committed Dec 1, 2023
1 parent f236fe3 commit 9949d48
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions test/test-integration.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ describe('integration tests', function () {
const helpers = createHelpers();
const appLocation = path.join(fileURLToPath(import.meta.url), '../../generators/app');

const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm';

it('command-ts integration test (install, compile and run extension tests)', async () => {

const runResult = await helpers.run(appLocation).withAnswers({
Expand All @@ -29,18 +31,18 @@ describe('integration tests', function () {
});

//console.log('command-ts with test: Running npm install');
const res = await doSpawn('npm', ['i'], { cwd: runResult.env.cwd });
const res = await doSpawn(npmCommand, ['i'], { cwd: runResult.env.cwd });
if (res.exitCode !== 0) {
assert.fail(`npm installed failed: stdout ${res.stdout} stderr ${res.stderr}`);
}

const resAudit = await doSpawn('npm', ['audit'], { cwd: runResult.env.cwd });
const resAudit = await doSpawn(npmCommand, ['audit'], { cwd: runResult.env.cwd });
if (resAudit.exitCode !== 0) {
assert.fail(`npm audit failed: stdout ${resAudit.stdout} stderr ${resAudit.stderr}`);
}

//console.log('command-ts with test: Running extension compile');
const res2 = await doSpawn('npm', ['run', 'test'], { cwd: runResult.env.cwd });
const res2 = await doSpawn(npmCommand, ['run', 'test'], { cwd: runResult.env.cwd });
if (res2.exitCode !== 0) {
assert.fail(`npm run test failed: stdout ${res2.stdout} stderr ${res2.stderr}`);
}
Expand All @@ -62,18 +64,18 @@ describe('integration tests', function () {
openWith: 'skip'
});

const res = await doSpawn('npm', ['i'], { cwd: runResult.env.cwd });
const res = await doSpawn(npmCommand, ['i'], { cwd: runResult.env.cwd });
if (res.exitCode !== 0) {
assert.fail(`npm installed failed: stdout ${res.stdout} stderr ${res.stderr}`);
}

const resAudit = await doSpawn('npm', ['audit'], { cwd: runResult.env.cwd });
const resAudit = await doSpawn(npmCommand, ['audit'], { cwd: runResult.env.cwd });
if (resAudit.exitCode !== 0) {
assert.fail(`npm audit failed: stdout ${resAudit.stdout} stderr ${resAudit.stderr}`);
}

//console.log('command-ts-webpack with test: Running extension compile');
const res2 = await doSpawn('npm', ['run', 'test'], { cwd: runResult.env.cwd });
const res2 = await doSpawn(npmCommand, ['run', 'test'], { cwd: runResult.env.cwd });
if (res2.exitCode !== 0) {
assert.fail(`npm run compile failed: stdout ${res2.stdout} stderr ${res2.stderr}`);
}
Expand All @@ -94,18 +96,18 @@ describe('integration tests', function () {
openWith: 'skip'
});

const res = await doSpawn('npm', ['i'], { cwd: runResult.env.cwd });
const res = await doSpawn(npmCommand, ['i'], { cwd: runResult.env.cwd });
if (res.exitCode !== 0) {
assert.fail(`npm installed failed: stdout ${res.stdout} stderr ${res.stderr}`);
}

const resAudit = await doSpawn('npm', ['audit'], { cwd: runResult.env.cwd });
const resAudit = await doSpawn(npmCommand, ['audit'], { cwd: runResult.env.cwd });
if (resAudit.exitCode !== 0) {
assert.fail(`npm audit failed: stdout ${resAudit.stdout} stderr ${resAudit.stderr}`);
}

//console.log('command-ts-web with test: Running extension compile-web');
const res2 = await doSpawn('npm', ['run', 'test'], { cwd: runResult.env.cwd });
const res2 = await doSpawn(npmCommand, ['run', 'test'], { cwd: runResult.env.cwd });
if (res2.exitCode !== 0) {
assert.fail(`npm run test failed: stdout ${res2.stdout} stderr ${res2.stderr}`);
}
Expand Down

0 comments on commit 9949d48

Please sign in to comment.