awesome-test-runner
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -41,2 +41,5 @@ { | ||
"func-names": ["off"] | ||
}, | ||
"parserOptions": { | ||
"project": "./tsconfig.tests.json" | ||
} | ||
@@ -43,0 +46,0 @@ } |
@@ -74,2 +74,8 @@ "use strict"; | ||
} | ||
const pullingSpinner = ora_1.default('Pulling container').start(); | ||
const { upToDate } = yield index_1.pullContainerImage(); | ||
if (upToDate) | ||
pullingSpinner.info(`Pulling container: ${chalk_1.default.blue('Already up to date')}`); | ||
else | ||
pullingSpinner.succeed(); | ||
const startingSpinner = ora_1.default('Starting docker container').start(); | ||
@@ -76,0 +82,0 @@ const runner = new index_1.Runner(); |
@@ -0,0 +0,0 @@ #!/usr/bin/env node |
@@ -28,2 +28,5 @@ export interface ResultSuccess { | ||
} | ||
export declare function pullContainerImage(): Promise<{ | ||
upToDate: boolean; | ||
}>; | ||
export declare function isDockerAvailable(): Promise<boolean>; |
@@ -15,3 +15,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isDockerAvailable = exports.Runner = exports.Language = void 0; | ||
exports.isDockerAvailable = exports.pullContainerImage = exports.Runner = exports.Language = void 0; | ||
const path_1 = __importDefault(require("path")); | ||
@@ -24,2 +24,3 @@ const utils_1 = require("./utils"); | ||
})(Language = exports.Language || (exports.Language = {})); | ||
const containerImageName = 'dominikkorsa/runner:1.0.0'; | ||
class Runner { | ||
@@ -30,3 +31,3 @@ start() { | ||
return; | ||
this.containerId = (yield utils_1.execPromise('docker run -d -i --rm dominikkorsa/runner:1.0.0')).stdout.trim(); | ||
this.containerId = (yield utils_1.execPromise(`docker run -d -i --rm ${containerImageName}`)).stdout.trim(); | ||
}); | ||
@@ -106,2 +107,11 @@ } | ||
exports.Runner = Runner; | ||
function pullContainerImage() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const { stdout } = yield utils_1.execPromise(`docker pull ${containerImageName}`); | ||
return { | ||
upToDate: stdout.includes('Status: Image is up to date'), | ||
}; | ||
}); | ||
} | ||
exports.pullContainerImage = pullContainerImage; | ||
function isDockerAvailable() { | ||
@@ -108,0 +118,0 @@ return __awaiter(this, void 0, void 0, function* () { |
{ | ||
"name": "awesome-test-runner", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "Safely test console programs in Docker containers", | ||
@@ -14,3 +14,3 @@ "main": "dist/index.js", | ||
"test": "mocha -r ts-node/register tests/**.ts", | ||
"prepare": "npm run build && crlf --set=LF dist/*", | ||
"prepublishOnly": "npm run build && crlf --set=LF dist/*", | ||
"release": "release-it --only-version", | ||
@@ -17,0 +17,0 @@ "lint": "eslint src tests -c .eslintrc.json", |
@@ -9,3 +9,3 @@ import yargs from 'yargs'; | ||
import sequential from 'promise-sequential'; | ||
import { Runner, Result } from '../../index'; | ||
import { Runner, Result, pullContainerImage } from '../../index'; | ||
import { globPromise } from '../../utils'; | ||
@@ -64,2 +64,7 @@ | ||
const pullingSpinner = ora('Pulling container').start(); | ||
const { upToDate } = await pullContainerImage(); | ||
if (upToDate) pullingSpinner.info(`Pulling container: ${chalk.blue('Already up to date')}`); | ||
else pullingSpinner.succeed(); | ||
const startingSpinner = ora('Starting docker container').start(); | ||
@@ -66,0 +71,0 @@ const runner = new Runner(); |
@@ -26,2 +26,4 @@ import path from 'path'; | ||
const containerImageName = 'dominikkorsa/runner:1.0.0'; | ||
export class Runner { | ||
@@ -34,3 +36,3 @@ private containerId?: string; | ||
if (this.containerId !== undefined) return; | ||
this.containerId = (await execPromise('docker run -d -i --rm dominikkorsa/runner:1.0.0')).stdout.trim(); | ||
this.containerId = (await execPromise(`docker run -d -i --rm ${containerImageName}`)).stdout.trim(); | ||
} | ||
@@ -95,2 +97,11 @@ | ||
export async function pullContainerImage(): Promise<{ | ||
upToDate: boolean, | ||
}> { | ||
const { stdout } = await execPromise(`docker pull ${containerImageName}`); | ||
return { | ||
upToDate: stdout.includes('Status: Image is up to date'), | ||
}; | ||
} | ||
export async function isDockerAvailable(): Promise<boolean> { | ||
@@ -97,0 +108,0 @@ try { |
@@ -22,5 +22,4 @@ { | ||
"include": [ | ||
"src", | ||
"tests" | ||
"src" | ||
] | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
3
1
46095
38
976