Skip to content

Commit

Permalink
test: remove tests previously migrated to jest
Browse files Browse the repository at this point in the history
  • Loading branch information
maxjeffos committed Feb 26, 2021
1 parent e203fd1 commit 02c99b8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 226 deletions.
112 changes: 0 additions & 112 deletions test/acceptance/cli-args.test.ts
Expand Up @@ -346,118 +346,6 @@ test('`test --json-file-output no value produces error message`', (t) => {
optionsToTest.forEach(validate);
});

test('`test --json-file-output can save JSON output to file while sending human readable output to stdout`', (t) => {
t.plan(2);
const tmpFolder = randomTmpFolderPath();
const jsonPath = path.normalize(
`${tmpFolder}/snyk-direct-json-test-output.json`,
);

const testFixture =
'test/acceptance/workspaces/npm-package-no-vulns/package.json';

exec(
`node ${main} test --file=${testFixture} --json-file-output=${jsonPath}`,
(err, stdout) => {
if (err) {
console.log('CLI stdout: ', stdout);
throw err;
}
if (!existsSync(jsonPath)) {
console.log('CLI stdout: ', stdout);
}
const outputFileContents = readFileSync(jsonPath, 'utf-8');
const jsonObj = JSON.parse(outputFileContents);
const okValue = jsonObj.ok as boolean;

t.match(stdout, 'Organization:', 'contains human readable output');
t.ok(okValue, 'JSON output ok');
},
);
});

test('`test --json-file-output produces same JSON output as normal JSON output to stdout`', (t) => {
t.plan(1);
const tmpFolder = randomTmpFolderPath();
const jsonPath = path.normalize(
`${tmpFolder}/snyk-direct-json-test-output.json`,
);
const testFixture =
'test/acceptance/workspaces/npm-package-no-vulns/package.json';
exec(
`node ${main} test --file=${testFixture} --json --json-file-output=${jsonPath}`,
(err, stdout) => {
if (err) {
console.log('CLI stdout: ', stdout);
throw err;
}
const stdoutJson = stdout;
if (!existsSync(jsonPath)) {
console.log('CLI stdout: ', stdout);
}
const outputFileContents = readFileSync(jsonPath, 'utf-8');

t.equals(stdoutJson, outputFileContents);
},
);
});

test('`test --json-file-output can handle a relative path`', (t) => {
t.plan(1);
const tmpFolder = randomTmpFolderPath();
const outputPath = path.normalize(
`${tmpFolder}/snyk-direct-json-test-output.json`,
);
const testFixture =
'test/acceptance/workspaces/npm-package-no-vulns/package.json';
exec(
`node ${main} test --file=${testFixture} --json --json-file-output=${outputPath}`,
(err, stdout) => {
if (err) {
console.log('CLI stdout: ', stdout);
throw err;
}
const stdoutJson = stdout;
if (!existsSync(outputPath)) {
console.log('CLI stdout: ', stdout);
}
const outputFileContents = readFileSync(outputPath, 'utf-8');

t.equals(stdoutJson, outputFileContents);
},
);
});

test(
'`test --json-file-output can handle an absolute path`',
{ skip: isWindows },
(t) => {
t.plan(1);
const tmpFolder = randomTmpFolderPath();
const outputPath = path.normalize(
`${tmpFolder}/snyk-direct-json-test-output.json`,
);
const testFixture =
'test/acceptance/workspaces/npm-package-no-vulns/package.json';
exec(
`node ${main} test --file=${testFixture} --json --json-file-output=${outputPath}`,
(err, stdout) => {
if (err) {
console.log('CLI stdout: ', stdout);
throw err;
}
const stdoutJson = stdout;
if (!existsSync(outputPath)) {
console.log('CLI stdout: ', stdout);
}
const outputFileContents = readFileSync(outputPath, 'utf-8');

t.equals(stdoutJson, outputFileContents);
},
);
},
);

test('flags not allowed with --sarif', (t) => {
t.plan(4);
exec(`node ${main} test iac --sarif --json`, (err, stdout) => {
Expand Down
114 changes: 0 additions & 114 deletions test/system/cli-json-file-output.test.ts

This file was deleted.

0 comments on commit 02c99b8

Please sign in to comment.