diff --git a/Dockerfile.template b/Dockerfile.template index 8e2db25d..d213faac 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -96,13 +96,13 @@ COPY --from=build-base /usr/src/app/node_modules ./node_modules # Copy build files COPY build-utils ./build-utils -COPY webpack.config.js tsconfig.json tsconfig.release.json ./ +COPY webpack.config.js tsconfig.json tsconfig.release.json tsconfig.js.json ./ COPY src ./src COPY test ./test COPY typings ./typings # Run the tests -RUN npm run test-nolint +RUN npm run test ################################################### # Build the production package diff --git a/package.json b/package.json index 224175b2..fc35d0b0 100644 --- a/package.json +++ b/package.json @@ -1,143 +1,137 @@ { - "name": "balena-supervisor", - "description": "This is balena's Supervisor, a program that runs on IoT devices and has the task of running user Apps (which are Docker containers), and updating them as the balena API informs it to.", - "version": "14.0.13", - "license": "Apache-2.0", - "repository": { - "type": "git", - "url": "https://github.com/balena-os/balena-supervisor.git" - }, - "scripts": { - "start": "./entry.sh", - "build": "npm run release && webpack", - "build:debug": "npm run release && npm run packagejson:copy", - "lint": "balena-lint -e ts -e js --typescript src/ test/ typings/ build-utils/ webpack.config.js && tsc --noEmit && tsc --noEmit --project tsconfig.js.json", - "test": "npm run clean && npm run test-nolint", - "posttest": "npm run lint", - "test-nolint": "npm run test:build && TEST=1 mocha --config test/.mocharc.js", - "test:build": "npm run test-build && npm run testitems:copy && npm run packagejson:copy", - "test:fast": "TEST=1 mocha --config test/.mocharc.fast.js", - "test:debug": "npm run test:build && TEST=1 mocha --inspect-brk --config test/.mocharc.js", - "prettify": "balena-lint -e ts -e js --typescript --fix src/ test/ typings/ build-utils/ webpack.config.js", - "test-build": "tsc --project tsconfig.json", - "release": "tsc --project tsconfig.release.json && mv build/src/* build", - "packagejson:copy": "cp package.json build/", - "testitems:copy": "cp -r test/data build/test/", - "sync": "ts-node --files sync/sync.ts", - "clean": "rimraf build" - }, - "private": true, - "dependencies": { - "@balena/happy-eyeballs": "0.0.6", - "dbus": "^1.0.7", - "mdns-resolver": "^1.0.0", - "semver": "^7.3.2", - "sinon": "^11.1.2", - "sqlite3": "^4.1.1", - "systeminformation": "^5.6.10" - }, - "engines": { - "node": "^12.16.2", - "npm": "^6.14.4" - }, - "devDependencies": { - "@balena/contrato": "^0.6.0", - "@balena/lint": "^5.1.0", - "@types/bluebird": "^3.5.32", - "@types/chai": "^4.2.16", - "@types/chai-as-promised": "^7.1.3", - "@types/chai-like": "^1.1.0", - "@types/chai-things": "0.0.34", - "@types/common-tags": "^1.8.0", - "@types/copy-webpack-plugin": "^6.0.0", - "@types/dbus": "^1.0.0", - "@types/dockerode": "^2.5.34", - "@types/event-stream": "^3.3.34", - "@types/express": "^4.17.3", - "@types/lodash": "^4.14.159", - "@types/memoizee": "^0.4.4", - "@types/mocha": "^8.2.2", - "@types/mock-fs": "^4.13.0", - "@types/morgan": "^1.9.0", - "@types/node": "^12.12.54", - "@types/request": "^2.48.5", - "@types/rewire": "^2.5.28", - "@types/rimraf": "^2.0.4", - "@types/rwlock": "^5.0.2", - "@types/semver": "^7.3.3", - "@types/shell-quote": "^1.7.0", - "@types/sinon": "^10.0.11", - "@types/sinon-chai": "^3.2.5", - "@types/supertest": "^2.0.11", - "@types/terser-webpack-plugin": "^3.0.0", - "@types/tmp": "^0.1.0", - "@types/webpack": "^4.41.21", - "@types/yargs": "^15.0.12", - "balena-register-device": "^7.2.0", - "blinking": "^0.0.4", - "bluebird": "^3.7.2", - "chai": "^4.3.4", - "chai-as-promised": "^7.1.1", - "chai-like": "^1.1.1", - "chai-things": "^0.2.0", - "chokidar": "^3.5.1", - "common-tags": "^1.8.0", - "copy-webpack-plugin": "^6.0.3", - "deep-object-diff": "^1.1.0", - "docker-delta": "^2.2.11", - "docker-progress": "^4.0.3", - "dockerode": "^2.5.8", - "duration-js": "^4.0.0", - "event-stream": "3.3.4", - "express": "^4.17.1", - "fork-ts-checker-webpack-plugin": "^5.1.0", - "fp-ts": "^2.8.1", - "husky": "^4.2.5", - "io-ts": "^2.2.10", - "io-ts-reporters": "^1.2.2", - "json-mask": "^0.3.9", - "knex": "^0.20.13", - "lint-staged": "^10.2.11", - "livepush": "^3.5.1", - "lodash": "^4.17.21", - "memoizee": "^0.4.14", - "mixpanel": "^0.10.3", - "mocha": "^8.3.2", - "mock-fs": "^4.14.0", - "morgan": "^1.10.0", - "network-checker": "^0.1.1", - "nock": "^13.1.2", - "nodemon": "^2.0.4", - "pinejs-client-request": "^7.2.1", - "pretty-ms": "^7.0.1", - "request": "^2.88.2", - "resin-docker-build": "^1.1.6", - "resumable-request": "^2.0.1", - "rewire": "^5.0.0", - "rimraf": "^2.7.1", - "rwlock": "^5.0.0", - "shell-quote": "^1.7.2", - "sinon-chai": "^3.6.0", - "strict-event-emitter-types": "^2.0.0", - "supertest": "^6.1.3", - "tar-stream": "^2.1.3", - "terser-webpack-plugin": "^4.1.0", - "tmp": "^0.1.0", - "ts-loader": "^7.0.5", - "ts-node": "^8.10.2", - "typed-error": "^3.2.1", - "typescript": "^4.2.4", - "webpack": "^4.44.1", - "webpack-cli": "^3.3.12", - "winston": "^3.3.3", - "yargs": "^15.4.1" - }, - "husky": { - "hooks": { - "pre-commit": "lint-staged" - } - }, - "versionist": { - "publishedAt": "2022-08-02T21:43:16.303Z" - } + "name": "balena-supervisor", + "description": "This is balena's Supervisor, a program that runs on IoT devices and has the task of running user Apps (which are Docker containers), and updating them as the balena API informs it to.", + "version": "14.0.13", + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "https://github.com/balena-os/balena-supervisor.git" + }, + "scripts": { + "start": "./entry.sh", + "build": "npm run clean && npm run release && webpack", + "lint": "balena-lint -e ts -e js --typescript src/ test/ typings/ build-utils/ webpack.config.js", + "test:build": "tsc --noEmit && tsc --noEmit --project tsconfig.js.json", + "test:node": "mocha --config test/.mocharc.js", + "test": "npm run lint && npm run test:build && npm run test:node", + "test:fast": "npm run test:build && npm run test:node", + "prettify": "balena-lint -e ts -e js --typescript --fix src/ test/ typings/ build-utils/ webpack.config.js", + "release": "tsc --project tsconfig.release.json && mv build/src/* build", + "sync": "ts-node --files sync/sync.ts", + "clean": "rimraf build" + }, + "private": true, + "dependencies": { + "@balena/happy-eyeballs": "0.0.6", + "dbus": "^1.0.7", + "mdns-resolver": "^1.0.0", + "semver": "^7.3.2", + "sinon": "^11.1.2", + "sqlite3": "^4.1.1", + "systeminformation": "^5.6.10" + }, + "engines": { + "node": "^12.16.2", + "npm": "^6.14.4" + }, + "devDependencies": { + "@balena/contrato": "^0.6.0", + "@balena/lint": "^5.1.0", + "@types/bluebird": "^3.5.32", + "@types/chai": "^4.2.16", + "@types/chai-as-promised": "^7.1.3", + "@types/chai-like": "^1.1.0", + "@types/chai-things": "0.0.34", + "@types/common-tags": "^1.8.0", + "@types/copy-webpack-plugin": "^6.0.0", + "@types/dbus": "^1.0.0", + "@types/dockerode": "^2.5.34", + "@types/event-stream": "^3.3.34", + "@types/express": "^4.17.3", + "@types/lodash": "^4.14.159", + "@types/memoizee": "^0.4.4", + "@types/mocha": "^8.2.2", + "@types/mock-fs": "^4.13.0", + "@types/morgan": "^1.9.0", + "@types/node": "^12.12.54", + "@types/request": "^2.48.5", + "@types/rewire": "^2.5.28", + "@types/rimraf": "^2.0.4", + "@types/rwlock": "^5.0.2", + "@types/semver": "^7.3.3", + "@types/shell-quote": "^1.7.0", + "@types/sinon": "^10.0.11", + "@types/sinon-chai": "^3.2.5", + "@types/supertest": "^2.0.11", + "@types/terser-webpack-plugin": "^3.0.0", + "@types/tmp": "^0.1.0", + "@types/webpack": "^4.41.21", + "@types/yargs": "^15.0.12", + "balena-register-device": "^7.2.0", + "blinking": "^0.0.4", + "bluebird": "^3.7.2", + "chai": "^4.3.4", + "chai-as-promised": "^7.1.1", + "chai-like": "^1.1.1", + "chai-things": "^0.2.0", + "chokidar": "^3.5.1", + "common-tags": "^1.8.0", + "copy-webpack-plugin": "^6.0.3", + "deep-object-diff": "^1.1.0", + "docker-delta": "^2.2.11", + "docker-progress": "^4.0.3", + "dockerode": "^2.5.8", + "duration-js": "^4.0.0", + "event-stream": "3.3.4", + "express": "^4.17.1", + "fork-ts-checker-webpack-plugin": "^5.1.0", + "fp-ts": "^2.8.1", + "husky": "^4.2.5", + "io-ts": "^2.2.10", + "io-ts-reporters": "^1.2.2", + "json-mask": "^0.3.9", + "knex": "^0.20.13", + "lint-staged": "^10.2.11", + "livepush": "^3.5.1", + "lodash": "^4.17.21", + "memoizee": "^0.4.14", + "mixpanel": "^0.10.3", + "mocha": "^8.3.2", + "mock-fs": "^4.14.0", + "morgan": "^1.10.0", + "network-checker": "^0.1.1", + "nock": "^13.1.2", + "nodemon": "^2.0.4", + "pinejs-client-request": "^7.2.1", + "pretty-ms": "^7.0.1", + "request": "^2.88.2", + "resin-docker-build": "^1.1.6", + "resumable-request": "^2.0.1", + "rewire": "^5.0.0", + "rimraf": "^2.7.1", + "rwlock": "^5.0.0", + "shell-quote": "^1.7.2", + "sinon-chai": "^3.6.0", + "strict-event-emitter-types": "^2.0.0", + "supertest": "^6.1.3", + "tar-stream": "^2.1.3", + "terser-webpack-plugin": "^4.1.0", + "tmp": "^0.1.0", + "ts-loader": "^7.0.5", + "ts-node": "^8.10.2", + "typed-error": "^3.2.1", + "typescript": "^4.2.4", + "webpack": "^4.44.1", + "webpack-cli": "^3.3.12", + "winston": "^3.3.3", + "yargs": "^15.4.1" + }, + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + }, + "versionist": { + "publishedAt": "2022-08-02T21:43:16.303Z" + } } diff --git a/test/.mocharc.fast.js b/test/.mocharc.fast.js deleted file mode 100644 index bb81f4a4..00000000 --- a/test/.mocharc.fast.js +++ /dev/null @@ -1,12 +0,0 @@ -module.exports = { - bail: true, // Exit test script on first error - exit: true, // Force Mocha to exit after tests complete - recursive: true, // Look for tests in subdirectories - require: [ - // Files to execute before running suites - 'ts-node/register/transpile-only', - 'test/config/fixtures.ts', - ], - spec: ['test/**/*.spec.ts'], - timeout: '30000', -}; diff --git a/test/.mocharc.js b/test/.mocharc.js index 45196be2..bb81f4a4 100644 --- a/test/.mocharc.js +++ b/test/.mocharc.js @@ -4,8 +4,9 @@ module.exports = { recursive: true, // Look for tests in subdirectories require: [ // Files to execute before running suites - 'build/test/config/fixtures.js', + 'ts-node/register/transpile-only', + 'test/config/fixtures.ts', ], - spec: ['build/test/**/*.spec.js'], + spec: ['test/**/*.spec.ts'], timeout: '30000', };