Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jest-editor-support

Package Overview
Dependencies
Maintainers
5
Versions
119
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-editor-support - npm Package Compare versions

Comparing version 21.3.0-alpha.1e3ee68e to 21.3.0-alpha.eff7a1cf

build/Snapshot.js

29

build/index.js

@@ -14,23 +14,18 @@ 'use strict';var _Process;

function _load_Runner() {return _Runner = _interopRequireDefault(require('./Runner'));}var _Settings;
function _load_Settings() {return _Settings = _interopRequireDefault(require('./Settings'));}var _parser_nodes;
function _load_Settings() {return _Settings = _interopRequireDefault(require('./Settings'));}var _Snapshot;
function _load_Snapshot() {return _Snapshot = _interopRequireDefault(require('./Snapshot'));}var _parser_nodes;
function _load_parser_nodes() {return _parser_nodes = require('./parsers/parser_nodes');}var _babylon_parser;
function _load_babylon_parser() {return _babylon_parser = require('./parsers/babylon_parser');}var _test_reconciler;
function _load_test_reconciler() {return _test_reconciler = _interopRequireDefault(require('./test_reconciler'));}function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function _interopRequireWildcard(obj) {if (obj && obj.__esModule) {return obj;} else {var newObj = {};if (obj != null) {for (var key in obj) {if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];}}newObj.default = obj;return newObj;}}
module.exports = {
Expect: (_parser_nodes || _load_parser_nodes()).Expect,
ItBlock: (_parser_nodes || _load_parser_nodes()).ItBlock,
Node: (_parser_nodes || _load_parser_nodes()).Node,
Process: _Process || _load_Process(),
ProjectWorkspace: (_project_workspace || _load_project_workspace()).default,
function _load_test_reconciler() {return _test_reconciler = _interopRequireDefault(require('./test_reconciler'));}function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function _interopRequireWildcard(obj) {if (obj && obj.__esModule) {return obj;} else {var newObj = {};if (obj != null) {for (var key in obj) {if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];}}newObj.default = obj;return newObj;}} /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/module.exports = { Expect: (_parser_nodes || _load_parser_nodes()).Expect, ItBlock: (_parser_nodes || _load_parser_nodes()).ItBlock, Node: (_parser_nodes || _load_parser_nodes()).Node, Process: _Process || _load_Process(), ProjectWorkspace: (_project_workspace || _load_project_workspace()).default,
Runner: (_Runner || _load_Runner()).default,
Settings: (_Settings || _load_Settings()).default,
Snapshot: (_Snapshot || _load_Snapshot()).default,
TestReconciler: (_test_reconciler || _load_test_reconciler()).default,
parse: (_babylon_parser || _load_babylon_parser()).parse }; /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
parse: (_babylon_parser || _load_babylon_parser()).parse };

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

'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports.parse = undefined;var _fs;
'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports.parse = exports.getASTfor = undefined;var _fs;

@@ -20,11 +20,15 @@

const parse = exports.parse = file => {
const itBlocks = [];
const expects = [];
const getASTfor = exports.getASTfor = file => {
const data = (0, (_fs || _load_fs()).readFileSync)(file).toString();
const config = { plugins: ['*'], sourceType: 'module' };
const ast = (0, (_babylon || _load_babylon()).parse)(data, config);
return (0, (_babylon || _load_babylon()).parse)(data, config);
}; /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/const parse = exports.parse = file => {const itBlocks = [];const expects = [];const ast = getASTfor(file);
// An `it`/`test` was found in the AST

@@ -175,9 +179,2 @@ // So take the AST node and create an object for us

}; /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
};

@@ -31,2 +31,3 @@ 'use strict';Object.defineProperty(exports, "__esModule", { value: true });var _child_process;

constructor(workspace, options) {

@@ -39,6 +40,9 @@ super();

start() {
start() {let watchMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
if (this.debugprocess) {
return;
}
this.watchMode = watchMode;
// Handle the arg change on v18

@@ -48,10 +52,5 @@ const belowEighteen = this.workspace.localJestMajorVersion < 18;

const args = [
'--json',
'--useStderr',
'--watch',
outputArg,
this.outputPath];
const args = ['--json', '--useStderr', outputArg, this.outputPath];
if (this.watchMode) args.push('--watch');
this.debugprocess = this._createProcess(this.workspace, args);

@@ -58,0 +57,0 @@ this.debugprocess.stdout.on('data', data => {

@@ -35,2 +35,4 @@ 'use strict';Object.defineProperty(exports, "__esModule", { value: true });var _child_process;

class Settings extends (_events || _load_events()).default {

@@ -46,2 +48,3 @@

constructor(workspace, options) {

@@ -57,2 +60,4 @@ super();

this.configs = [this.settings];
}

@@ -65,10 +70,7 @@

this.getConfigProcess.stdout.on('data', data => {var _JSON$parse =
JSON.parse(data.toString());const configs = _JSON$parse.configs,version = _JSON$parse.version;
// We can give warnings to versions under 17 now
// See https://github.com/facebook/jest/issues/2343 for moving this into
// the config object
this.jestVersionMajor = parseInt(version.split('.').shift(), 10);
this.settings = configs;
this.getConfigProcess.stdout.on('data', data => {
const settings = JSON.parse(data.toString());
this.jestVersionMajor = parseInt(settings.version.split('.').shift(), 10);
this.configs =
this.jestVersionMajor >= 21 ? settings.configs : [settings.config];
});

@@ -83,5 +85,5 @@

getConfig(completed) {
getConfig(completed) {let index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
this.getConfigs(() => {
this.settings = this.settings[0];
this.settings = this.configs[index];
completed();

@@ -88,0 +90,0 @@ });

@@ -33,5 +33,2 @@ 'use strict';Object.defineProperty(exports, "__esModule", { value: true });var _path;

constructor() {

@@ -41,8 +38,11 @@ this.fileStatuses = {};

updateFileWithJestStatus(results) {
this.fails = [];
this.passes = [];
this.skips = [];
// the processed test results will be returned immediately instead of saved in
// instance properties. This is 1) to prevent race condition 2) the data is already
// stored in the this.fileStatuses, no dup is better 3) client will most likely need to process
// all the results anyway.
updateFileWithJestStatus(
results)
{
// Loop through all files inside the report from Jest
const statusList = [];
results.testResults.forEach(file => {

@@ -59,25 +59,7 @@ // Did the file pass/fail?

this.fileStatuses[file.name] = fileStatus;
if (status === 'KnownFail') {
this.fails.push(fileStatus);
} else if (status === 'KnownSuccess') {
this.passes.push(fileStatus);
} else if (status === 'KnownSkip') {
this.skips.push(fileStatus);
}
statusList.push(fileStatus);
});
return statusList;
}
failedStatuses() {
return this.fails || [];
}
passedStatuses() {
return this.passes || [];
}
skipedStatuses() {
return this.skips || [];
}
// A failed test also contains the stack trace for an `expect`

@@ -168,2 +150,7 @@ // we don't get this as structured data, but what we get

assertionsForTestFile(file) {
const results = this.fileStatuses[file];
return results ? results.assertions : null;
}
stateForTestAssertion(

@@ -174,3 +161,3 @@ file,

const results = this.fileStatuses[file];
if (!results) {
if (!results || !results.assertions) {
return null;

@@ -177,0 +164,0 @@ }

@@ -8,7 +8,8 @@ /**

import {EventEmitter} from 'events';
import { EventEmitter } from 'events';
export class Runner extends EventEmitter {
constructor(workspace: ProjectWorkspace);
start(): void;
watchMode: boolean;
start(watchMode?: boolean): void;
closeProcess(): void;

@@ -32,3 +33,3 @@ runJestWithUpdateForSnapshots(completion: any): void;

pathToConfig: string,
localJestMajorVersin: number
localJestMajorVersin: number,
);

@@ -66,11 +67,15 @@ pathToJest: string;

stateForTestFile(file: string): TestReconcilationState;
stateForTestAssertion(file: string, name: string): TestFileAssertionStatus | null;
failedStatuses(): Array<TestFileAssertionStatus>;
updateFileWithJestStatus(data): void;
assertionsForTestFile(file: string): TestAssertionStatus[] | null;
stateForTestAssertion(
file: string,
name: string,
): TestFileAssertionStatus | null;
updateFileWithJestStatus(data): TestFileAssertionStatus[];
}
export type TestReconcilationState = "Unknown" |
"KnownSuccess" |
"KnownFail" |
"KnownSkip";
export type TestReconcilationState =
| 'Unknown'
| 'KnownSuccess'
| 'KnownFail'
| 'KnownSkip';

@@ -97,3 +102,3 @@ export interface TestFileAssertionStatus {

message: string;
status: "failed" | "passed";
status: 'failed' | 'passed';
startTime: number;

@@ -107,3 +112,3 @@ endTime: number;

title: string;
status: "failed" | "passed";
status: 'failed' | 'passed';
failureMessages: string[];

@@ -110,0 +115,0 @@ }

{
"name": "jest-editor-support",
"version": "21.3.0-alpha.1e3ee68e",
"version": "21.3.0-alpha.eff7a1cf",
"repository": {

@@ -11,5 +11,7 @@ "type": "git",

"dependencies": {
"babylon": "^6.14.1"
"babel-traverse": "^6.14.1",
"babylon": "^6.14.1",
"jest-snapshot": "21.3.0-alpha.eff7a1cf"
},
"typings": "index.d.ts"
}
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