feat: setup deno testing and coverage
parent
d915ae20f1
commit
56d0646e9b
|
|
@ -1,6 +1,7 @@
|
|||
.idea
|
||||
node_modules
|
||||
coverage/
|
||||
.coverage/
|
||||
lib/
|
||||
.vsconfig
|
||||
yarn-error.log
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
import { open } from 'https://deno.land/x/opener/mod.ts';
|
||||
|
||||
await open(`file://${Deno.cwd()}/.coverage/report/index.html`);
|
||||
|
|
@ -1,4 +1,8 @@
|
|||
{
|
||||
"tasks": {
|
||||
"test": "deno test -A ./src/integrity.test.ts",
|
||||
"coverage": "rm -rf .coverage ; deno test -A ./src/integrity.test.ts --coverage=.coverage/raw ; deno coverage .coverage/raw --lcov --output=.coverage/raw/.lcov ; perl C:\\ProgramData\\chocolatey\\lib\\lcov\\tools\\bin\\genhtml -q -o .coverage/report .coverage/raw/.lcov && deno run -A .tools/open-coverage-report.ts"
|
||||
},
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"lib": ["deno.window"],
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import { Buffer } from 'https://deno.land/std@0.151.0/io/buffer.ts';
|
|||
import { config, configSync } from 'https://deno.land/std@0.151.0/dotenv/mod.ts';
|
||||
import yargs from 'https://deno.land/x/yargs@v17.5.1-deno/deno.ts';
|
||||
import type { Arguments as YargsArguments } from 'https://deno.land/x/yargs@v17.5.1-deno/deno-types.ts';
|
||||
import { default as getHomeDir } from 'https://deno.land/x/dir@1.5.1/home_dir/mod.ts';
|
||||
|
||||
// Internally managed packages
|
||||
import waitUntil from './module/wait-until.ts';
|
||||
|
|
@ -31,6 +32,9 @@ import { dedent } from './module/dedent.ts';
|
|||
// Polyfill for https://github.com/tc39/proposal-string-dedent
|
||||
String.dedent = dedent;
|
||||
|
||||
// Errors from yargs can be very verbose and not very descriptive
|
||||
Error.stackTraceLimit = 15;
|
||||
|
||||
class Writable {
|
||||
constructor() {
|
||||
throw new Error('Writable is not implemented'); // stream
|
||||
|
|
@ -65,6 +69,7 @@ export {
|
|||
crypto,
|
||||
fs,
|
||||
fsSync,
|
||||
getHomeDir,
|
||||
getUnityChangeSet,
|
||||
http,
|
||||
nanoid,
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
export { assert, assertFalse, assertEquals, assertThrows } from 'https://deno.land/std@0.153.0/testing/asserts.ts';
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
export class Foo {
|
||||
public static bar() {
|
||||
return 'bar';
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,25 @@
|
|||
import { fs } from '../dependencies.ts';
|
||||
import { assert, assertFalse, assertEquals, assertThrows } from './deps-test.ts';
|
||||
import { existsSync } from 'https://deno.land/std/fs/mod.ts';
|
||||
import { Foo } from './foo.ts';
|
||||
|
||||
describe('Integrity tests', () => {
|
||||
describe('package-lock.json', () => {
|
||||
it('does not exist', async () => {
|
||||
await expect(fs.stat(`${process.cwd()}/package-lock.json`)).rejects.toThrowError();
|
||||
});
|
||||
});
|
||||
// Todo - Remove this test after we have some coverage
|
||||
assertEquals(Foo.bar(), 'bar');
|
||||
|
||||
// Todo - Enable this test, once node_modules are completely phased out.
|
||||
// Deno.test('package.json does not exist', async () => {
|
||||
// assertFalse(existsSync(`${Deno.cwd()}/package.json`));
|
||||
// });
|
||||
|
||||
Deno.test('package-lock.json does not exist', async () => {
|
||||
assertFalse(existsSync(`${Deno.cwd()}/package-lock.json`));
|
||||
});
|
||||
|
||||
// Todo - Enable this test, once node_modules are completely phased out.
|
||||
// Deno.test('yarn.lock does not exist', async () => {
|
||||
// assertFalse(existsSync(`${Deno.cwd()}/yarn.lock`));
|
||||
// });
|
||||
|
||||
// Todo - Enable this test, once node_modules are completely phased out.
|
||||
// Deno.test('node_modules does not exist', async () => {
|
||||
// assertFalse(existsSync(`${Deno.cwd()}/node_modules`));
|
||||
// });
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import * as Index from '.';
|
||||
import * as Index from './index.ts';
|
||||
|
||||
describe('Index', () => {
|
||||
test.each(['Action', 'BuildParameters', 'Cache', 'Docker', 'ImageTag', 'Input', 'Platform', 'Project', 'Unity'])(
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
import { default as getHomeDir } from 'https://deno.land/x/dir@1.5.1/home_dir/mod.ts';
|
||||
import AndroidBuildVersionGenerator from '../middleware/build-versioning/android-build-version-generator.ts';
|
||||
import Input from './input.ts';
|
||||
import UnityTargetPlatform from './unity/unity-target-platform.ts';
|
||||
import UnityVersionDetector from '../middleware/engine-detection/unity-version-detector.ts';
|
||||
import BuildVersionGenerator from '../middleware/build-versioning/build-version-generator.ts';
|
||||
import { GitRepoReader } from './input-readers/git-repo.ts';
|
||||
import { CommandInterface } from '../command/command-interface.ts';
|
||||
|
|
|
|||
Loading…
Reference in New Issue