New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

babel-test

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-test - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

41

package.json
{
"name": "babel-test",
"version": "0.2.3",
"version": "0.2.4",
"description": "An opinionated library to make testing Babel plugins easier",

@@ -32,17 +32,18 @@ "keywords": [

"devDependencies": {
"@babel/core": "^7.1.6",
"@types/babel__core": "^7.0.4",
"@types/jest": "^23.3.10",
"@types/node": "^10.12.15",
"codecov": "^3.1.0",
"conventional-changelog-cli": "^2.0.11",
"eslint": "^5.9.0",
"eslint-config-satya164": "^2.0.1",
"husky": "^1.2.0",
"jest": "^23.6.0",
"jest-file-snapshot": "^0.2.1",
"prettier": "^1.15.2",
"release-it": "^9.1.0",
"ts-jest": "^23.10.5",
"typescript": "^3.2.2"
"@babel/core": "^7.12.3",
"@release-it/conventional-changelog": "^2.0.0",
"@types/babel__core": "^7.1.10",
"@types/jest": "^26.0.15",
"@types/node": "^14.14.6",
"babel-core": "^6.26.3",
"codecov": "^3.8.0",
"eslint": "^7.12.1",
"eslint-config-satya164": "^3.1.8",
"husky": "^4.3.0",
"jest": "^26.6.1",
"jest-file-snapshot": "^0.3.8",
"prettier": "^2.1.2",
"release-it": "^14.2.0",
"ts-jest": "^26.4.3",
"typescript": "^4.0.5"
},

@@ -68,6 +69,6 @@ "jest": {

"dependencies": {
"chalk": "^2.4.1",
"error-stack-parser": "^2.0.2",
"escape-string-regexp": "^1.0.5",
"strip-ansi": "^5.0.0"
"chalk": "^4.1.0",
"error-stack-parser": "^2.0.6",
"escape-string-regexp": "^4.0.0",
"strip-ansi": "^6.0.0"
},

@@ -74,0 +75,0 @@ "husky": {

@@ -0,1 +1,3 @@

/* eslint-disable jest/consistent-test-it */
const path = require('path');

@@ -2,0 +4,0 @@ const { toMatchFile } = require('jest-file-snapshot');

@@ -1,2 +0,1 @@

/* eslint-disable jest/no-disabled-tests, jest/no-focused-tests */
/* istanbul ignore file */

@@ -72,4 +71,4 @@

fs.readdirSync(directory)
.filter(f => fs.lstatSync(path.join(directory, f)).isDirectory())
.forEach(f => {
.filter((f) => fs.lstatSync(path.join(directory, f)).isDirectory())
.forEach((f) => {
// Respect skip. and only. prefixes in folder names

@@ -87,3 +86,3 @@ const t = f.startsWith('skip.')

return Promise.resolve(callback(content, { filename })).then(
output => {
(output) => {
try {

@@ -123,9 +122,18 @@ if ('expect' in global) {

const helper = e => (code, { filename }) => {
const helper = (e) => (code, { filename }) => {
// We should filter out stack traces from the library
const stack = ErrorStackParser.parse(e)
.filter(s => s.fileName !== __filename)
.map(s => s.source)
.filter((s) => s.fileName !== __filename)
.map((s) => s.source)
.join('\n');
class TestError extends Error {
constructor(message) {
super(message);
this.message = message;
this.stack = `\n${stack}`;
}
}
const output = path.join(path.dirname(filename), 'output.js');

@@ -137,3 +145,3 @@ const error = path.join(path.dirname(filename), 'error.js');

// If the fixture has files for output and error, one needs to be removed
const e = new Error(
throw new TestError(
// By default, Jest will grey out the text and highlight the stack trace

@@ -149,6 +157,2 @@ // We force it to be white for more emphasis on the message

);
e.stack = `${e.message}\n${stack}`;
throw e;
}

@@ -163,20 +167,44 @@

}).then(
({ code }) => ({
filename: output,
content: code + '\n',
stack,
}),
e => ({
filename: error,
// Errors might have ansi colors, for example babel codeframe error
// Strip them so the error is more readable
// Also replace the current working directory with a placeholder
// This makes sure that the stacktraces are same across machines
content:
stripAnsi(e.stack).replace(
new RegExp(escapeRegexp(process.cwd()), 'g'),
'<cwd>'
) + '\n',
stack,
})
({ code }) => {
if (fs.existsSync(error)) {
throw new TestError(
chalk.white(
`The test previously failed with an error, but passed for this run.\n\nIf this is expected, remove the file ${chalk.blue(
path.basename(error)
)} to continue.`
)
);
}
return {
filename: output,
content: code + '\n',
stack,
};
},
(e) => {
if (fs.existsSync(output)) {
throw new TestError(
chalk.white(
`The test previously passed, but failed with an error for this run.\n\nIf this is expected, remove the file ${chalk.blue(
path.basename(output)
)} to continue.`
)
);
}
return {
filename: error,
// Errors might have ansi colors, for example babel codeframe error
// Strip them so the error is more readable
// Also replace the current working directory with a placeholder
// This makes sure that the stacktraces are same across machines
content:
stripAnsi(e.stack).replace(
new RegExp(escapeRegexp(process.cwd()), 'g'),
'<cwd>'
) + '\n',
stack,
};
}
);

@@ -183,0 +211,0 @@ };

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc