mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-30 02:28:51 +00:00
Merge pull request #1656 from balena-io/type-check-tests
Add type checking for tests
This commit is contained in:
commit
a4de7143b1
@ -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"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
16
package.json
16
package.json
@ -43,23 +43,23 @@
|
|||||||
"postinstall": "patch-package",
|
"postinstall": "patch-package",
|
||||||
"prebuild": "rimraf build/ build-bin/",
|
"prebuild": "rimraf build/ build-bin/",
|
||||||
"build": "npm run build:src && npm run catch-uncommitted",
|
"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:fast": "gulp build && tsc",
|
||||||
"build:automation": "tsc -P automation/tsconfig.json --noEmit",
|
"build:test": "tsc -P ./tsconfig.dev.json --noEmit",
|
||||||
"build:doc": "mkdirp doc/ && ts-node --transpile-only -P automation/tsconfig.json automation/capitanodoc/index.ts > doc/cli.markdown",
|
"build:doc": "mkdirp doc/ && ts-node --transpile-only automation/capitanodoc/index.ts > doc/cli.markdown",
|
||||||
"build:standalone": "ts-node --transpile-only -P automation/tsconfig.json automation/run.ts build:standalone",
|
"build:standalone": "ts-node --transpile-only automation/run.ts build:standalone",
|
||||||
"build:installer": "ts-node --transpile-only -P automation/tsconfig.json automation/run.ts build:installer",
|
"build:installer": "ts-node --transpile-only automation/run.ts build:installer",
|
||||||
"package": "npm run build:fast && npm run build:standalone && npm run 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",
|
"pretest": "npm run build",
|
||||||
"test": "mocha --timeout 6000 -r ts-node/register/transpile-only \"tests/**/*.spec.ts\"",
|
"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\"",
|
"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",
|
"ci": "npm run test && npm run catch-uncommitted",
|
||||||
"watch": "gulp watch",
|
"watch": "gulp watch",
|
||||||
"prettify": "prettier --write \"{lib,tests,automation,typings}/**/*.js\" --config ./node_modules/resin-lint/config/.prettierrc",
|
"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/",
|
"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"
|
"prepublishOnly": "npm run build"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
@ -323,10 +323,6 @@ describe('balena push: project validation', function() {
|
|||||||
const expectedErrorLines = [
|
const expectedErrorLines = [
|
||||||
'The --nolive flag is only valid when pushing to a local mode device',
|
'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(
|
const { out, err } = await runCommand(
|
||||||
`push testApp --source ${projectPath} --nolive --noparent-check`,
|
`push testApp --source ${projectPath} --nolive --noparent-check`,
|
||||||
|
@ -217,7 +217,7 @@ export async function testPushBuildStream(o: {
|
|||||||
const queryParams = Array.from(url.searchParams.entries());
|
const queryParams = Array.from(url.searchParams.entries());
|
||||||
expect(queryParams).to.have.deep.members(expectedQueryParams);
|
expect(queryParams).to.have.deep.members(expectedQueryParams);
|
||||||
},
|
},
|
||||||
checkBuildRequestBody: (buildRequestBody: string) =>
|
checkBuildRequestBody: buildRequestBody =>
|
||||||
inspectTarStream(buildRequestBody, o.expectedFiles, o.projectPath),
|
inspectTarStream(buildRequestBody, o.expectedFiles, o.projectPath),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -129,10 +129,18 @@ export function fillTemplate(
|
|||||||
return unescaped;
|
return unescaped;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function fillTemplateArray(
|
||||||
|
templateStringArray: string[],
|
||||||
|
templateVars: object,
|
||||||
|
): string[];
|
||||||
export function fillTemplateArray(
|
export function fillTemplateArray(
|
||||||
templateStringArray: Array<string | string[]>,
|
templateStringArray: Array<string | string[]>,
|
||||||
templateVars: object,
|
templateVars: object,
|
||||||
) {
|
): Array<string | string[]>;
|
||||||
|
export function fillTemplateArray(
|
||||||
|
templateStringArray: Array<string | string[]>,
|
||||||
|
templateVars: object,
|
||||||
|
): Array<string | string[]> {
|
||||||
return templateStringArray.map(i =>
|
return templateStringArray.map(i =>
|
||||||
Array.isArray(i)
|
Array.isArray(i)
|
||||||
? fillTemplateArray(i, templateVars)
|
? fillTemplateArray(i, templateVars)
|
||||||
|
9
tsconfig.dev.json
Normal file
9
tsconfig.dev.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"include": [
|
||||||
|
"./automation/**/*.ts",
|
||||||
|
"./lib/**/*.ts",
|
||||||
|
"./tests/**/*.ts",
|
||||||
|
"./typings/**/*.ts"
|
||||||
|
]
|
||||||
|
}
|
@ -16,7 +16,8 @@
|
|||||||
"./node_modules/@types",
|
"./node_modules/@types",
|
||||||
"./node_modules/etcher-sdk/typings",
|
"./node_modules/etcher-sdk/typings",
|
||||||
"./typings"
|
"./typings"
|
||||||
]
|
],
|
||||||
|
"preserveSymlinks": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./lib/**/*.ts"
|
"./lib/**/*.ts"
|
||||||
|
Loading…
Reference in New Issue
Block a user