Comparing version 0.17.0 to 0.18.0
@@ -37,3 +37,3 @@ var __defProp = Object.defineProperty; | ||
"@types/node": "^16.11.6", | ||
aocrunner: "^0.17.0", | ||
aocrunner: "^0.18.0", | ||
prettier: "^2.4.1" | ||
@@ -40,0 +40,0 @@ }, |
@@ -15,4 +15,5 @@ declare type Tests = { | ||
}; | ||
rawTestInput?: boolean; | ||
}; | ||
declare const run: (solutions: Solutions, inputFile?: string | undefined) => void; | ||
export default run; |
@@ -7,6 +7,7 @@ import fs from "fs"; | ||
import { saveConfig, readConfig } from "./io/config.js"; | ||
const runTests = async (tests, solution, part) => { | ||
const runTests = async (tests, solution, part, rawTestInput = false) => { | ||
for (let i = 0; i < tests.length; i++) { | ||
const { input, expected } = tests[i]; | ||
const result = await solution(input); | ||
const data = rawTestInput ? input : stripIndent(input); | ||
const result = await solution(data); | ||
if (result === expected) { | ||
@@ -13,0 +14,0 @@ console.log(kleur.green(`Part ${part}, test ${i + 1} - passed`)); |
{ | ||
"name": "aocrunner", | ||
"version": "0.17.0", | ||
"version": "0.18.0", | ||
"description": "Advent of Code runner", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -21,3 +21,3 @@ import type { Setup } from "../types/common" | ||
"@types/node": "^16.11.6", | ||
aocrunner: "^0.17.0", | ||
aocrunner: "^0.18.0", | ||
prettier: "^2.4.1", | ||
@@ -24,0 +24,0 @@ }, |
@@ -20,9 +20,18 @@ import fs from "fs" | ||
} | ||
rawTestInput?: boolean | ||
} | ||
const runTests = async (tests: Tests, solution: Solution, part: number) => { | ||
const runTests = async ( | ||
tests: Tests, | ||
solution: Solution, | ||
part: number, | ||
rawTestInput = false, | ||
) => { | ||
for (let i = 0; i < tests.length; i++) { | ||
const { input, expected } = tests[i] | ||
const result = await solution(input) | ||
const data = rawTestInput ? input : stripIndent(input) | ||
const result = await solution(data) | ||
if (result === expected) { | ||
@@ -29,0 +38,0 @@ console.log(kleur.green(`Part ${part}, test ${i + 1} - passed`)) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
97417
1911