Add type checking for tests

Change-type: patch
This commit is contained in:
Pagan Gazzard 2020-03-10 16:56:42 +00:00
parent 3e1b10007a
commit 1ee74df67e
6 changed files with 27 additions and 33 deletions

View File

@ -1,19 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es2017",
"strict": true,
"strictPropertyInitialization": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
"preserveConstEnums": true,
"removeComments": true,
"resolveJsonModule": true,
"sourceMap": true,
"skipLibCheck": true,
"typeRoots" : [
"../node_modules/@types",
"../typings"
]
}
}

View File

@ -43,23 +43,23 @@
"postinstall": "patch-package",
"prebuild": "rimraf build/ build-bin/",
"build": "npm run build:src && npm run catch-uncommitted",
"build:src": "npm run prettify && npm run lint && npm run build:automation && npm run build:fast && npm run build:doc",
"build:src": "npm run prettify && npm run lint && npm run build:fast && npm run build:test && npm run build:doc",
"build:fast": "gulp build && tsc",
"build:automation": "tsc -P automation/tsconfig.json --noEmit",
"build:doc": "mkdirp doc/ && ts-node --transpile-only -P automation/tsconfig.json automation/capitanodoc/index.ts > doc/cli.markdown",
"build:standalone": "ts-node --transpile-only -P automation/tsconfig.json automation/run.ts build:standalone",
"build:installer": "ts-node --transpile-only -P automation/tsconfig.json automation/run.ts build:installer",
"build:test": "tsc -P ./tsconfig.dev.json --noEmit",
"build:doc": "mkdirp doc/ && ts-node --transpile-only automation/capitanodoc/index.ts > doc/cli.markdown",
"build:standalone": "ts-node --transpile-only automation/run.ts build:standalone",
"build:installer": "ts-node --transpile-only automation/run.ts build:installer",
"package": "npm run build:fast && npm run build:standalone && npm run build:installer",
"release": "ts-node --transpile-only -P automation/tsconfig.json automation/run.ts release",
"release": "ts-node --transpile-only automation/run.ts release",
"pretest": "npm run build",
"test": "mocha --timeout 6000 -r ts-node/register/transpile-only \"tests/**/*.spec.ts\"",
"test:fast": "npm run build:fast && mocha --timeout 6000 -r ts-node/register/transpile-only \"tests/**/*.spec.ts\"",
"catch-uncommitted": "ts-node --transpile-only -P automation/tsconfig.json automation/run.ts catch-uncommitted",
"catch-uncommitted": "ts-node --transpile-only automation/run.ts catch-uncommitted",
"ci": "npm run test && npm run catch-uncommitted",
"watch": "gulp watch",
"prettify": "prettier --write \"{lib,tests,automation,typings}/**/*.js\" --config ./node_modules/resin-lint/config/.prettierrc",
"lint": "resin-lint lib/ tests/ && resin-lint --typescript --fix automation/ lib/ typings/ tests/",
"update": "ts-node --transpile-only -P automation/tsconfig.json ./automation/update-module.ts",
"update": "ts-node --transpile-only ./automation/update-module.ts",
"prepublishOnly": "npm run build"
},
"keywords": [

View File

@ -323,10 +323,6 @@ describe('balena push: project validation', function() {
const expectedErrorLines = [
'The --nolive flag is only valid when pushing to a local mode device',
];
const expectedOutputLines = [
'[Warn] "docker-compose.y[a]ml" file found in parent directory: please check',
"[Warn] that the correct folder was specified. (Suppress with '--noparent-check'.)",
];
const { out, err } = await runCommand(
`push testApp --source ${projectPath} --nolive --noparent-check`,

View File

@ -217,7 +217,7 @@ export async function testPushBuildStream(o: {
const queryParams = Array.from(url.searchParams.entries());
expect(queryParams).to.have.deep.members(expectedQueryParams);
},
checkBuildRequestBody: (buildRequestBody: string) =>
checkBuildRequestBody: buildRequestBody =>
inspectTarStream(buildRequestBody, o.expectedFiles, o.projectPath),
});

View File

@ -129,10 +129,18 @@ export function fillTemplate(
return unescaped;
}
export function fillTemplateArray(
templateStringArray: string[],
templateVars: object,
): string[];
export function fillTemplateArray(
templateStringArray: Array<string | string[]>,
templateVars: object,
) {
): Array<string | string[]>;
export function fillTemplateArray(
templateStringArray: Array<string | string[]>,
templateVars: object,
): Array<string | string[]> {
return templateStringArray.map(i =>
Array.isArray(i)
? fillTemplateArray(i, templateVars)

9
tsconfig.dev.json Normal file
View File

@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"include": [
"./automation/**/*.ts",
"./lib/**/*.ts",
"./tests/**/*.ts",
"./typings/**/*.ts"
]
}