48 lines
6.7 KiB
JavaScript
48 lines
6.7 KiB
JavaScript
"use strict";
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const path_1 = require("path");
|
|
const lodash_1 = require("lodash");
|
|
const internal_modules_prefix_1 = __importDefault(require("./internal-modules-prefix"));
|
|
const is_file_protocol_1 = __importDefault(require("../shared/utils/is-file-protocol"));
|
|
const BABEL = require.resolve('@babel/core');
|
|
const BABEL_MODULES_DIR = BABEL.replace(new RegExp(`^(.*${(0, lodash_1.escapeRegExp)(path_1.sep)}node_modules${(0, lodash_1.escapeRegExp)(path_1.sep)})(.*)`), '$1');
|
|
const BABEL_7 = BABEL_MODULES_DIR + '@babel';
|
|
const BABEL_RELATED = BABEL_MODULES_DIR + 'babel-';
|
|
const REGENERATOR_RUNTIME = BABEL_MODULES_DIR + 'regenerator-runtime' + path_1.sep;
|
|
const GENSYNC = BABEL_MODULES_DIR + 'gensync'; // NOTE: @babel/parser uses this module internally.
|
|
const TESTCAFE_LIB = (0, path_1.join)(__dirname, '../');
|
|
const TESTCAFE_BIN = (0, path_1.join)(__dirname, '../../bin');
|
|
const TESTCAFE_SRC = (0, path_1.join)(__dirname, '../../src');
|
|
const TESTCAFE_HAMMERHEAD = require.resolve('testcafe-hammerhead');
|
|
const SOURCE_MAP_SUPPORT = require.resolve('source-map-support');
|
|
const INTERNAL_STARTS_WITH_PATH_SEGMENTS = [
|
|
TESTCAFE_LIB,
|
|
TESTCAFE_BIN,
|
|
TESTCAFE_SRC,
|
|
BABEL_RELATED,
|
|
REGENERATOR_RUNTIME,
|
|
GENSYNC,
|
|
BABEL_7,
|
|
internal_modules_prefix_1.default,
|
|
];
|
|
const INTERNAL_INCLUDES_PATH_SEGMENTS = [
|
|
SOURCE_MAP_SUPPORT,
|
|
TESTCAFE_HAMMERHEAD,
|
|
];
|
|
function isInternalFile(filename = '') {
|
|
return !filename ||
|
|
!(filename.includes(path_1.sep) || (0, is_file_protocol_1.default)(filename)) ||
|
|
INTERNAL_INCLUDES_PATH_SEGMENTS.some(pathSegment => filename.includes(pathSegment)) ||
|
|
INTERNAL_STARTS_WITH_PATH_SEGMENTS.some(pathSegment => filename.startsWith(pathSegment));
|
|
}
|
|
function default_1(frame) {
|
|
// NOTE: filter out the internals of node.js and assertion libraries
|
|
const filename = frame.getFileName();
|
|
return isInternalFile(filename);
|
|
}
|
|
exports.default = default_1;
|
|
module.exports = exports.default;
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaXMtaW50ZXJuYWwtc3RhY2stZnJhbWUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZXJyb3JzL2lzLWludGVybmFsLXN0YWNrLWZyYW1lLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsK0JBQWlDO0FBQ2pDLG1DQUFrRDtBQUNsRCx3RkFBZ0U7QUFFaEUsd0ZBQThEO0FBRTlELE1BQU0sS0FBSyxHQUFpQixPQUFPLENBQUMsT0FBTyxDQUFDLGFBQWEsQ0FBQyxDQUFDO0FBQzNELE1BQU0saUJBQWlCLEdBQUssS0FBSyxDQUFDLE9BQU8sQ0FBQyxJQUFJLE1BQU0sQ0FBQyxPQUFPLElBQUEscUJBQVEsRUFBQyxVQUFHLENBQUMsZUFBZSxJQUFBLHFCQUFRLEVBQUMsVUFBRyxDQUFDLE9BQU8sQ0FBQyxFQUFFLElBQUksQ0FBQyxDQUFDO0FBQ3JILE1BQU0sT0FBTyxHQUFlLGlCQUFpQixHQUFHLFFBQVEsQ0FBQztBQUN6RCxNQUFNLGFBQWEsR0FBUyxpQkFBaUIsR0FBRyxRQUFRLENBQUM7QUFDekQsTUFBTSxtQkFBbUIsR0FBRyxpQkFBaUIsR0FBRyxxQkFBcUIsR0FBRyxVQUFHLENBQUM7QUFDNU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