UNPKG

console-fail-test

Version:

Gently fails test runs if the console was used during them. 📢

1 lines • 1.31 kB
{"version":3,"sources":["../../src/environments/vitest.ts"],"sourcesContent":["import { TestFrameworkSelector } from \"./testEnvironmentTypes.js\";\n\ndeclare interface VitestModule {\n\tafterEach: (callback: () => void) => void;\n\tbeforeEach: (callback: () => void) => void;\n}\n\ndeclare const __vitest_index__: VitestModule | undefined;\n\nexport const selectVitestEnvironment: TestFrameworkSelector = () => {\n\tif (typeof __vitest_index__ === \"undefined\") {\n\t\treturn undefined;\n\t}\n\n\tconst vitest = __vitest_index__;\n\n\tlet afterEachCallback: (() => void) | undefined;\n\tlet beforeEachCallback: (() => void) | undefined;\n\n\tvitest.afterEach(() => {\n\t\tafterEachCallback?.();\n\t});\n\n\tvitest.beforeEach(() => {\n\t\tbeforeEachCallback?.();\n\t});\n\n\treturn {\n\t\tafterEach: (callback) => {\n\t\t\tafterEachCallback = callback;\n\t\t},\n\t\tbeforeEach: (callback) => {\n\t\t\tbeforeEachCallback = callback;\n\t\t},\n\t};\n};\n"],"mappings":"AASO,MAAM,0BAAiD,MAAM;AACnE,MAAI,OAAO,qBAAqB,aAAa;AAC5C,WAAO;AAAA,EACR;AAEA,QAAM,SAAS;AAEf,MAAI;AACJ,MAAI;AAEJ,SAAO,UAAU,MAAM;AACtB,wBAAoB;AAAA,EACrB,CAAC;AAED,SAAO,WAAW,MAAM;AACvB,yBAAqB;AAAA,EACtB,CAAC;AAED,SAAO;AAAA,IACN,WAAW,CAAC,aAAa;AACxB,0BAAoB;AAAA,IACrB;AAAA,IACA,YAAY,CAAC,aAAa;AACzB,2BAAqB;AAAA,IACtB;AAAA,EACD;AACD;","names":[]}