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

@stylable/core-test-kit

Package Overview
Dependencies
Maintainers
6
Versions
188
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stylable/core-test-kit - npm Package Compare versions

Comparing version 5.4.0 to 5.4.1-rc.1

dist/collect-ast.d.ts

1

dist/index.d.ts

@@ -6,4 +6,5 @@ export { Diagnostic, expectAnalyzeDiagnostics, expectTransformDiagnostics, findTestLocations, shouldReportNoDiagnostics, diagnosticBankReportToStrings, } from './diagnostics';

export { matchAllRulesAndDeclarations, matchRuleAndDeclaration } from './match-rules';
export { collectAst } from './collect-ast';
export { testInlineExpects, testInlineExpectsErrors } from './inline-expectation';
export { testStylableCore } from './test-stylable-core';
//# sourceMappingURL=index.d.ts.map

4

dist/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.testStylableCore = exports.testInlineExpectsErrors = exports.testInlineExpects = exports.matchRuleAndDeclaration = exports.matchAllRulesAndDeclarations = exports.matchCSSMatchers = exports.flatMatch = exports.generateStylableEnvironment = exports.processSource = exports.generateStylableRoot = exports.generateStylableResult = exports.generateStylableExports = exports.generateInfra = exports.createTransformer = exports.createProcess = exports.diagnosticBankReportToStrings = exports.shouldReportNoDiagnostics = exports.findTestLocations = exports.expectTransformDiagnostics = exports.expectAnalyzeDiagnostics = void 0;
exports.testStylableCore = exports.testInlineExpectsErrors = exports.testInlineExpects = exports.collectAst = exports.matchRuleAndDeclaration = exports.matchAllRulesAndDeclarations = exports.matchCSSMatchers = exports.flatMatch = exports.generateStylableEnvironment = exports.processSource = exports.generateStylableRoot = exports.generateStylableResult = exports.generateStylableExports = exports.generateInfra = exports.createTransformer = exports.createProcess = exports.diagnosticBankReportToStrings = exports.shouldReportNoDiagnostics = exports.findTestLocations = exports.expectTransformDiagnostics = exports.expectAnalyzeDiagnostics = void 0;
var diagnostics_1 = require("./diagnostics");

@@ -26,2 +26,4 @@ Object.defineProperty(exports, "expectAnalyzeDiagnostics", { enumerable: true, get: function () { return diagnostics_1.expectAnalyzeDiagnostics; } });

Object.defineProperty(exports, "matchRuleAndDeclaration", { enumerable: true, get: function () { return match_rules_1.matchRuleAndDeclaration; } });
var collect_ast_1 = require("./collect-ast");
Object.defineProperty(exports, "collectAst", { enumerable: true, get: function () { return collect_ast_1.collectAst; } });
var inline_expectation_1 = require("./inline-expectation");

@@ -28,0 +30,0 @@ Object.defineProperty(exports, "testInlineExpects", { enumerable: true, get: function () { return inline_expectation_1.testInlineExpects; } });

import type { StylableMeta } from '@stylable/core';
import type * as postcss from 'postcss';
interface Context {
meta: Pick<StylableMeta, 'sourceAst' | 'targetAst' | 'diagnostics' | 'transformDiagnostics'>;
meta: Pick<StylableMeta, 'source' | 'sourceAst' | 'targetAst' | 'diagnostics' | 'transformDiagnostics'>;
}

@@ -62,4 +62,5 @@ /**

combine: (errors: string[]) => string;
diagnosticsDump: ({ source, diagnostics, transformDiagnostics }: Context['meta']) => string;
};
export {};
//# sourceMappingURL=inline-expectation.d.ts.map

@@ -55,2 +55,3 @@ "use strict";

meta: {
source: '/undefined.st.css',
sourceAst: result,

@@ -99,2 +100,3 @@ targetAst: result,

],
hasMissingDiagnostic: false,
};

@@ -116,2 +118,5 @@ errors.push(...result.errors);

// report errors
if (checks.find((error) => error.hasMissingDiagnostic)) {
errors.push(exports.testInlineExpectsErrors.diagnosticsDump(context.meta));
}
if (errors.length) {

@@ -139,2 +144,3 @@ throw new Error(exports.testInlineExpectsErrors.combine(errors));

errors: [exports.testInlineExpectsErrors.unsupportedNode(`@check`, type)],
hasMissingDiagnostic: false,
};

@@ -149,2 +155,3 @@ }

errors: [],
hasMissingDiagnostic: false,
};

@@ -225,2 +232,3 @@ const { msg, ruleIndex, expectedSelector, expectedBody } = expectation.match(/(?<msg>\([^)]*\))*(\[(?<ruleIndex>\d+)\])*(?<expectedSelector>[^{}]*)\s*(?<expectedBody>.*)/s).groups;

errors: [],
hasMissingDiagnostic: false,
};

@@ -253,2 +261,3 @@ const { msg, expectedParams } = expectation.match(/(?<msg>\([^)]*\))*(?<expectedParams>.*)/)

errors: [],
hasMissingDiagnostic: false,
};

@@ -296,2 +305,3 @@ // eslint-disable-next-line prefer-const

errors: isRemoved ? [] : [exports.testInlineExpectsErrors.transformRemoved(node.type, label)],
hasMissingDiagnostic: false,
};

@@ -308,2 +318,3 @@ }

errors: [],
hasMissingDiagnostic: false,
};

@@ -341,3 +352,6 @@ const matchResult = expectation.match(/-(?<severity>\w+)(?<label>\([^)]*\))?\s?(?:word\((?<word>[^)]*)\))?\s?(?<message>[\s\S]*)/);

severityMismatch: exports.testInlineExpectsErrors.diagnosticsSeverityMismatch,
expectedNotFound: exports.testInlineExpectsErrors.diagnosticExpectedNotFound,
expectedNotFound: (...args) => {
result.hasMissingDiagnostic = true;
return exports.testInlineExpectsErrors.diagnosticExpectedNotFound(...args);
},
});

@@ -411,3 +425,30 @@ if (error) {

combine: (errors) => `\n${errors.join(`\n`)}`,
diagnosticsDump: ({ source, diagnostics, transformDiagnostics }) => {
const transformReport = (diagnostics) => {
return JSON.stringify(diagnostics.map((diagnostic) => {
const node = diagnostic.node.clone();
if ('nodes' in node) {
node.nodes = [];
}
return {
...diagnostic,
node: node.toString(),
};
}), null, 2);
};
const analyzedReports = transformReport(diagnostics.reports);
const transformReports = transformDiagnostics
? transformReport(transformDiagnostics.reports)
: 'not transformed';
return [
`********* Diagnostics DUMP *********`,
`Diagnostics found in ${source}:`,
' - analyze:',
analyzedReports,
' - transform:',
transformReports,
'***********************************',
].join('\n');
},
};
//# sourceMappingURL=inline-expectation.js.map
{
"name": "@stylable/core-test-kit",
"version": "5.4.0",
"version": "5.4.1-rc.1",
"description": "Stylable core test-kit",

@@ -11,3 +11,3 @@ "main": "dist/index.js",

"@file-services/memory": "^7.0.1",
"@stylable/core": "^5.4.0",
"@stylable/core": "5.4.1-rc.1",
"chai": "^4.3.7",

@@ -14,0 +14,0 @@ "flat": "^5.0.2",

@@ -26,3 +26,4 @@ export {

export { matchAllRulesAndDeclarations, matchRuleAndDeclaration } from './match-rules';
export { collectAst } from './collect-ast';
export { testInlineExpects, testInlineExpectsErrors } from './inline-expectation';
export { testStylableCore } from './test-stylable-core';
import { matchDiagnostic } from './diagnostics';
import type { StylableMeta } from '@stylable/core';
import type { Diagnostic, StylableMeta } from '@stylable/core';
import type * as postcss from 'postcss';

@@ -9,2 +9,3 @@

errors: string[];
hasMissingDiagnostic: boolean;
}

@@ -27,3 +28,6 @@

interface Context {
meta: Pick<StylableMeta, 'sourceAst' | 'targetAst' | 'diagnostics' | 'transformDiagnostics'>;
meta: Pick<
StylableMeta,
'source' | 'sourceAst' | 'targetAst' | 'diagnostics' | 'transformDiagnostics'
>;
}

@@ -70,2 +74,3 @@ const isRoot = (val: any): val is postcss.Root => val.type === `root`;

meta: {
source: '/undefined.st.css',
sourceAst: result,

@@ -122,2 +127,3 @@ targetAst: result,

],
hasMissingDiagnostic: false,
};

@@ -143,2 +149,5 @@ errors.push(...result.errors);

// report errors
if (checks.find((error) => error.hasMissingDiagnostic)) {
errors.push(testInlineExpectsErrors.diagnosticsDump(context.meta));
}
if (errors.length) {

@@ -171,2 +180,3 @@ throw new Error(testInlineExpectsErrors.combine(errors));

errors: [testInlineExpectsErrors.unsupportedNode(`@check`, type)],
hasMissingDiagnostic: false,
};

@@ -185,2 +195,3 @@ }

errors: [],
hasMissingDiagnostic: false,
};

@@ -283,2 +294,3 @@ const { msg, ruleIndex, expectedSelector, expectedBody } = expectation.match(

errors: [],
hasMissingDiagnostic: false,
};

@@ -320,2 +332,3 @@ const { msg, expectedParams } = expectation.match(/(?<msg>\([^)]*\))*(?<expectedParams>.*)/)!

errors: [],
hasMissingDiagnostic: false,
};

@@ -374,2 +387,3 @@ // eslint-disable-next-line prefer-const

errors: isRemoved ? [] : [testInlineExpectsErrors.transformRemoved(node.type, label)],
hasMissingDiagnostic: false,
};

@@ -391,2 +405,3 @@ }

errors: [],
hasMissingDiagnostic: false,
};

@@ -431,3 +446,6 @@ const matchResult = expectation.match(

severityMismatch: testInlineExpectsErrors.diagnosticsSeverityMismatch,
expectedNotFound: testInlineExpectsErrors.diagnosticExpectedNotFound,
expectedNotFound: (...args) => {
result.hasMissingDiagnostic = true;
return testInlineExpectsErrors.diagnosticExpectedNotFound(...args);
},
}

@@ -530,2 +548,34 @@ );

combine: (errors: string[]) => `\n${errors.join(`\n`)}`,
diagnosticsDump: ({ source, diagnostics, transformDiagnostics }: Context['meta']) => {
const transformReport = (diagnostics: Diagnostic[]) => {
return JSON.stringify(
diagnostics.map((diagnostic) => {
const node = diagnostic.node.clone();
if ('nodes' in node) {
(node as any).nodes = [];
}
return {
...diagnostic,
node: node.toString(),
};
}),
null,
2
);
};
const analyzedReports = transformReport(diagnostics.reports);
const transformReports = transformDiagnostics
? transformReport(transformDiagnostics.reports)
: 'not transformed';
return [
`********* Diagnostics DUMP *********`,
`Diagnostics found in ${source}:`,
' - analyze:',
analyzedReports,
' - transform:',
transformReports,
'***********************************',
].join('\n');
},
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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