luna-testing
Advanced tools
Comparing version 1.7.0 to 1.8.0
#!/usr/bin/env node | ||
/* Luna v1.7.0 */ | ||
/* Luna v1.8.0 */ | ||
'use strict'; | ||
@@ -394,3 +394,3 @@ | ||
if (options.verbose) { | ||
console.log(`🔌 Server started at ${chalk__default['default'].bold(`http://localhost:${options.port}`)}…`); | ||
console.log(`🔌 Server started at ${chalk__default["default"].bold(`http://localhost:${options.port}`)}…`); | ||
} | ||
@@ -405,3 +405,3 @@ }); | ||
if (code === undefined) { | ||
return chalk__default['default'].yellow('undefined'); | ||
return chalk__default["default"].yellow('undefined'); | ||
} | ||
@@ -416,7 +416,7 @@ | ||
code = code.replace(operator, (match) => chalk__default['default'].magenta(match)); | ||
code = code.replace(constant, (match) => chalk__default['default'].yellow(match)); | ||
code = code.replace(operator, (match) => chalk__default["default"].magenta(match)); | ||
code = code.replace(constant, (match) => chalk__default["default"].yellow(match)); | ||
for (const stringName of strings) { | ||
code = code.replace(stringName, chalk__default['default'].green(stringMap[stringName])); | ||
code = code.replace(stringName, chalk__default["default"].green(stringMap[stringName])); | ||
} | ||
@@ -896,3 +896,3 @@ | ||
const failures = parseInt(messageBits[2], 10); | ||
console.log(`${failures === 0 ? chalk__default['default'].green.bold('✔︎') : chalk__default['default'].red.bold('𝗫')} ${chalk__default['default'].gray(`[${testPath}]`)}`, messageBits[1]); | ||
console.log(`${failures === 0 ? chalk__default["default"].green.bold('✔︎') : chalk__default["default"].red.bold('𝗫')} ${chalk__default["default"].gray(`[${testPath}]`)}`, messageBits[1]); | ||
return false; | ||
@@ -960,17 +960,2 @@ } | ||
async function formatLog(msg) { | ||
return new Promise((resolve, reject) => { | ||
const text = msg._text; | ||
if (text === puppeteerObjectText) { | ||
const objectData = msg._args[0]._remoteObject.preview; | ||
msg._args[0].jsonValue().then((val) => { | ||
resolve([text, objectData.description, val]); | ||
}).catch(() => {}); | ||
return; | ||
} | ||
resolve(text); | ||
}); | ||
} | ||
async function runTestBrowser(browser, testPath, options) { | ||
@@ -993,3 +978,3 @@ return new Promise(async(resolve, reject) => { | ||
page.on('console', async(msg) => { | ||
const newMsg = await formatLog(msg); | ||
const newMsg = msg.text(); | ||
const resp = handleMessage(newMsg, testPath, options); | ||
@@ -1058,3 +1043,3 @@ if (resp) { | ||
if (message) { | ||
console.log(`⚠️ ${chalk__default['default'].bold(message)}`); | ||
console.log(`⚠️ ${chalk__default["default"].bold(message)}`); | ||
} | ||
@@ -1069,4 +1054,4 @@ process.exit(1); | ||
const indent = spaces(4); | ||
console.log(`\n${chalk__default['default'].yellow(formatLine(lineNumber - 1, lineWidth))}`); | ||
console.log(`${chalk__default['default'].yellow(formatLine(lineNumber, lineWidth))} ${indent}${syntaxHighlight(testData.source.code)}`); | ||
console.log(`\n${chalk__default["default"].yellow(formatLine(lineNumber - 1, lineWidth))}`); | ||
console.log(`${chalk__default["default"].yellow(formatLine(lineNumber, lineWidth))} ${indent}${syntaxHighlight(testData.source.code)}`); | ||
let leftIndex = testData.left.range[0]; | ||
@@ -1090,5 +1075,5 @@ | ||
if (leftIndex > -1) { | ||
console.log(`${chalk__default['default'].yellow(formatLine(lineNumber + 1, lineWidth))} ${indent}${spaces(leftIndex)}${chalk__default['default'].gray('|')}${rightIndex > -1 ? spaces(rightIndex - leftIndex - 1) + chalk__default['default'].gray('|') : ''}`); | ||
console.log(`${chalk__default["default"].yellow(formatLine(lineNumber + 1, lineWidth))} ${indent}${spaces(leftIndex)}${chalk__default["default"].gray('|')}${rightIndex > -1 ? spaces(rightIndex - leftIndex - 1) + chalk__default["default"].gray('|') : ''}`); | ||
if (rightIndex > -1) { | ||
console.log(`${spaces(lineWidth)} ${indent}${spaces(leftIndex)}${chalk__default['default'].gray('|')}${rightIndex > -1 ? spaces(rightIndex - leftIndex - 1) + syntaxHighlight(JSON.stringify(testData.right.value)) : ''}`); | ||
console.log(`${spaces(lineWidth)} ${indent}${spaces(leftIndex)}${chalk__default["default"].gray('|')}${rightIndex > -1 ? spaces(rightIndex - leftIndex - 1) + syntaxHighlight(JSON.stringify(testData.right.value)) : ''}`); | ||
} | ||
@@ -1100,8 +1085,8 @@ console.log(`${spaces(lineWidth)} ${indent}${spaces(leftIndex)}${syntaxHighlight(JSON.stringify(testData.left.value))}\n`); | ||
function logError(error, options) { | ||
console.log(`\n${chalk__default['default'].bold.underline(error.name)}\n`); | ||
console.log(`\n${chalk__default["default"].bold.underline(error.name)}\n`); | ||
if (error.type === 'taskerror') { | ||
console.log(`⚠️ ${chalk__default['default'].red(error.data)}\n`); | ||
console.log(`⚠️ ${chalk__default["default"].red(error.data)}\n`); | ||
if (!options.node) { | ||
console.log(`❓ Perhaps you meant to run your tests in node using the ${chalk__default['default'].bold('--node')} flag\n`); | ||
console.log(`❓ Perhaps you meant to run your tests in node using the ${chalk__default["default"].bold('--node')} flag\n`); | ||
} | ||
@@ -1116,3 +1101,3 @@ return; | ||
console.log(`❌ ${chalk__default['default'].red.bold(test.name)}`); | ||
console.log(`❌ ${chalk__default["default"].red.bold(test.name)}`); | ||
if (test.data) { | ||
@@ -1179,3 +1164,3 @@ logAssertion(test.data); | ||
console.log(chalk__default['default'].bold.underline.blue('Console Logs\n')); | ||
console.log(chalk__default["default"].bold.underline.blue('Console Logs\n')); | ||
for (const log of logs) { | ||
@@ -1232,3 +1217,3 @@ if (typeof log === 'object' && log.constructor.name === 'Array' && log[0] === puppeteerObjectText) { | ||
console.log(`\n💾 HTML coverage report available at ${chalk__default['default'].bold.underline('coverage/lcov-report/index.html')}`); | ||
console.log(`\n💾 HTML coverage report available at ${chalk__default["default"].bold.underline('coverage/lcov-report/index.html')}`); | ||
} | ||
@@ -1262,3 +1247,3 @@ | ||
if (!options.verbose) { | ||
bar = new ProgressBar__default['default']('⏳ [:bar] :percent (:current/:total)', { | ||
bar = new ProgressBar__default["default"]('⏳ [:bar] :percent (:current/:total)', { | ||
total: totalTests, | ||
@@ -1391,3 +1376,3 @@ width: 50, | ||
if (message) { | ||
console.log(`\n⚠️ ${chalk__default['default'].bold(message)}`); | ||
console.log(`\n⚠️ ${chalk__default["default"].bold(message)}`); | ||
} | ||
@@ -1394,0 +1379,0 @@ } |
{ | ||
"name": "luna-testing", | ||
"version": "1.7.0", | ||
"version": "1.8.0", | ||
"description": "A simple, modern, opinionated unit testing framework", | ||
@@ -28,14 +28,14 @@ "homepage": "https://craig.is/testing/code", | ||
"dependencies": { | ||
"chalk": "^4.1.1", | ||
"ci-info": "^3.1.1", | ||
"chalk": "^4.1.2", | ||
"ci-info": "^3.7.1", | ||
"escodegen": "^2.0.0", | ||
"eslint": "^7.25.0", | ||
"eslint": "^8.31.0", | ||
"esprima": "^4.0.1", | ||
"express": "^4.17.1", | ||
"istanbul-api": "^3.0.0", | ||
"istanbul-lib-coverage": "^3.0.0", | ||
"magic-string": "^0.25.7", | ||
"istanbul-lib-coverage": "^3.2.0", | ||
"magic-string": "^0.27.0", | ||
"progress": "^2.0.3", | ||
"puppeteer": "^9.0.0", | ||
"rollup": "^2.45.2", | ||
"puppeteer": "^19.5.2", | ||
"rollup": "^2.79.1", | ||
"rollup-plugin-buble": "^0.19.8", | ||
@@ -46,8 +46,8 @@ "rollup-plugin-istanbul": "^3.0.0", | ||
"rollup-plugin-svelte": "^7.1.0", | ||
"source-map": "^0.7.3", | ||
"source-map": "^0.7.4", | ||
"svelte": "^3.37.0", | ||
"v8-to-istanbul": "^2.1.0", | ||
"walk": "^2.3.14", | ||
"yargs": "^16.2.0" | ||
"walk": "^2.3.15", | ||
"yargs": "^17.6.2" | ||
} | ||
} |
@@ -163,17 +163,2 @@ // This is the runner that runs from node.js to execute the tests | ||
async function formatLog(msg) { | ||
return new Promise((resolve, reject) => { | ||
const text = msg._text; | ||
if (text === puppeteerObjectText) { | ||
const objectData = msg._args[0]._remoteObject.preview; | ||
msg._args[0].jsonValue().then((val) => { | ||
resolve([text, objectData.description, val]); | ||
}).catch(() => {}); | ||
return; | ||
} | ||
resolve(text); | ||
}); | ||
} | ||
async function runTestBrowser(browser, testPath, options) { | ||
@@ -196,3 +181,3 @@ return new Promise(async(resolve, reject) => { | ||
page.on('console', async(msg) => { | ||
const newMsg = await formatLog(msg); | ||
const newMsg = msg.text(); | ||
const resp = handleMessage(newMsg, testPath, options); | ||
@@ -199,0 +184,0 @@ if (resp) { |
109905
2575
+ Added@eslint-community/eslint-utils@4.4.1(transitive)
+ Added@eslint-community/regexpp@4.12.1(transitive)
+ Added@eslint/eslintrc@2.1.4(transitive)
+ Added@eslint/js@8.57.1(transitive)
+ Added@humanwhocodes/config-array@0.13.0(transitive)
+ Added@humanwhocodes/module-importer@1.0.1(transitive)
+ Added@humanwhocodes/object-schema@2.0.3(transitive)
+ Added@nodelib/fs.scandir@2.1.5(transitive)
+ Added@nodelib/fs.stat@2.0.5(transitive)
+ Added@nodelib/fs.walk@1.2.8(transitive)
+ Added@puppeteer/browsers@0.5.0(transitive)
+ Added@ungap/structured-clone@1.3.0(transitive)
+ Addedacorn@8.14.0(transitive)
+ Addedargparse@2.0.1(transitive)
+ Addedcaniuse-lite@1.0.30001701(transitive)
+ Addedchromium-bidi@0.4.7(transitive)
+ Addedcliui@8.0.1(transitive)
+ Addedcosmiconfig@8.1.3(transitive)
+ Addedcross-fetch@3.1.5(transitive)
+ Addeddebug@4.3.4(transitive)
+ Addeddevtools-protocol@0.0.1107588(transitive)
+ Addedelectron-to-chromium@1.5.109(transitive)
+ Addederror-ex@1.3.2(transitive)
+ Addedeslint@8.57.1(transitive)
+ Addedeslint-scope@7.2.2(transitive)
+ Addedeslint-visitor-keys@3.4.3(transitive)
+ Addedespree@9.6.1(transitive)
+ Addedfastq@1.19.1(transitive)
+ Addedfind-up@5.0.0(transitive)
+ Addedglob-parent@6.0.2(transitive)
+ Addedgraphemer@1.4.0(transitive)
+ Addedignore@5.3.2(transitive)
+ Addedis-arrayish@0.2.1(transitive)
+ Addedis-path-inside@3.0.3(transitive)
+ Addedjs-yaml@4.1.0(transitive)
+ Addedjson-parse-even-better-errors@2.3.1(transitive)
+ Addedlines-and-columns@1.2.4(transitive)
+ Addedlocate-path@6.0.0(transitive)
+ Addedmagic-string@0.27.0(transitive)
+ Addedmitt@3.0.0(transitive)
+ Addedms@2.1.2(transitive)
+ Addednode-fetch@2.6.7(transitive)
+ Addedp-limit@3.1.0(transitive)
+ Addedp-locate@5.0.0(transitive)
+ Addedparse-json@5.2.0(transitive)
+ Addedpath-type@4.0.0(transitive)
+ Addedpuppeteer@19.11.1(transitive)
+ Addedpuppeteer-core@19.11.1(transitive)
+ Addedqueue-microtask@1.2.3(transitive)
+ Addedreusify@1.1.0(transitive)
+ Addedrun-parallel@1.2.0(transitive)
+ Addedtar-fs@2.1.1(transitive)
+ Addedupdate-browserslist-db@1.1.3(transitive)
+ Addedws@8.13.0(transitive)
+ Addedyargs@17.7.117.7.2(transitive)
+ Addedyargs-parser@21.1.1(transitive)
+ Addedyocto-queue@0.1.0(transitive)
- Removed@babel/code-frame@7.12.11(transitive)
- Removed@babel/highlight@7.25.9(transitive)
- Removed@eslint/eslintrc@0.4.3(transitive)
- Removed@humanwhocodes/config-array@0.5.0(transitive)
- Removed@humanwhocodes/object-schema@1.2.1(transitive)
- Removedacorn@7.4.1(transitive)
- Removedajv@8.17.1(transitive)
- Removedansi-colors@4.1.3(transitive)
- Removedastral-regex@2.0.0(transitive)
- Removedcaniuse-lite@1.0.30001700(transitive)
- Removedcliui@7.0.4(transitive)
- Removeddevtools-protocol@0.0.869402(transitive)
- Removedelectron-to-chromium@1.5.104(transitive)
- Removedenquirer@2.4.1(transitive)
- Removedeslint@7.32.0(transitive)
- Removedeslint-scope@5.1.1(transitive)
- Removedeslint-utils@2.1.0(transitive)
- Removedeslint-visitor-keys@1.3.02.1.0(transitive)
- Removedespree@7.3.1(transitive)
- Removedestraverse@4.3.0(transitive)
- Removedfast-uri@3.0.6(transitive)
- Removedfind-up@4.1.0(transitive)
- Removedfunctional-red-black-tree@1.0.1(transitive)
- Removedglob-parent@5.1.2(transitive)
- Removedignore@4.0.6(transitive)
- Removedjson-schema-traverse@1.0.0(transitive)
- Removedlocate-path@5.0.0(transitive)
- Removedlodash.truncate@4.4.2(transitive)
- Removednode-fetch@2.7.0(transitive)
- Removedp-limit@2.3.0(transitive)
- Removedp-locate@4.1.0(transitive)
- Removedp-try@2.2.0(transitive)
- Removedpkg-dir@4.2.0(transitive)
- Removedpuppeteer@9.1.1(transitive)
- Removedregexpp@3.2.0(transitive)
- Removedrequire-from-string@2.0.2(transitive)
- Removedsemver@7.7.1(transitive)
- Removedslice-ansi@4.0.0(transitive)
- Removedtable@6.9.0(transitive)
- Removedtar-fs@2.1.2(transitive)
- Removedupdate-browserslist-db@1.1.2(transitive)
- Removedv8-compile-cache@2.4.0(transitive)
- Removedws@7.5.10(transitive)
- Removedyargs@16.2.0(transitive)
- Removedyargs-parser@20.2.9(transitive)
Updatedchalk@^4.1.2
Updatedci-info@^3.7.1
Updatedeslint@^8.31.0
Updatedistanbul-lib-coverage@^3.2.0
Updatedmagic-string@^0.27.0
Updatedpuppeteer@^19.5.2
Updatedrollup@^2.79.1
Updatedsource-map@^0.7.4
Updatedwalk@^2.3.15
Updatedyargs@^17.6.2