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
7
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 4.6.0 to 4.7.0

4

dist/diagnostics.d.ts
import type { Position } from 'postcss';
import { StylableMeta, StylableResults } from '@stylable/core';
import { DiagnosticType, StylableMeta, StylableResults } from '@stylable/core';
import { Config } from './generate-test-util';
export interface Diagnostic {
severity?: 'warning' | 'error';
severity?: DiagnosticType;
message: string;

@@ -7,0 +7,0 @@ file: string;

@@ -50,4 +50,4 @@ "use strict";

const source = findTestLocations(css);
const root = core_1.safeParse(source.css);
const res = core_1.process(root);
const root = (0, core_1.safeParse)(source.css);
const res = (0, core_1.process)(root);
res.diagnostics.reports.forEach((report, i) => {

@@ -58,12 +58,12 @@ const expectedWarning = warnings[i];

}
chai_1.expect(report.message).to.equal(expectedWarning.message);
chai_1.expect(report.node.source.start, 'start').to.eql(source.start);
(0, chai_1.expect)(report.message).to.equal(expectedWarning.message);
(0, chai_1.expect)(report.node.source.start, 'start').to.eql(source.start);
if (source.word !== null) {
chai_1.expect(report.options.word).to.equal(source.word);
(0, chai_1.expect)(report.options.word).to.equal(source.word);
}
if (expectedWarning.severity) {
chai_1.expect(report.type, `diagnostics severity mismatch, expected "${expectedWarning.severity}" but received "${report.type}"`).to.equal(expectedWarning.severity);
(0, chai_1.expect)(report.type, `diagnostics severity mismatch, expected "${expectedWarning.severity}" but received "${report.type}"`).to.equal(expectedWarning.severity);
}
});
chai_1.expect(res.diagnostics.reports.length, 'diagnostics reports match').to.equal(warnings.length);
(0, chai_1.expect)(res.diagnostics.reports.length, 'diagnostics reports match').to.equal(warnings.length);
}

@@ -75,3 +75,3 @@ exports.expectWarnings = expectWarnings;

for (const path in config.files) {
const source = findTestLocations(deindent_1.default(config.files[path].content).trim());
const source = findTestLocations((0, deindent_1.default)(config.files[path].content).trim());
config.files[path].content = source.css;

@@ -81,6 +81,6 @@ locations[path] = source;

const diagnostics = new core_1.Diagnostics();
const result = generate_test_util_1.generateStylableResult(config, diagnostics);
const result = (0, generate_test_util_1.generateStylableResult)(config, diagnostics);
const warningMessages = diagnostics.reports.map((d) => d.message);
if (expectedWarnings.length === 0 && diagnostics.reports.length !== 0) {
chai_1.expect(expectedWarnings.length, `expected no diagnostics but received ${JSON.stringify(warningMessages, null, 2)}`).to.equal(diagnostics.reports.length);
(0, chai_1.expect)(expectedWarnings.length, `expected no diagnostics but received ${JSON.stringify(warningMessages, null, 2)}`).to.equal(diagnostics.reports.length);
}

@@ -93,14 +93,14 @@ for (const [i, report] of diagnostics.reports.entries()) {

const path = expectedWarning.file;
chai_1.expect(report.message).to.equal(expectedWarning.message);
(0, chai_1.expect)(report.message).to.equal(expectedWarning.message);
if (!expectedWarning.skipLocationCheck) {
chai_1.expect(report.node.source.start).to.eql(locations[path].start);
(0, chai_1.expect)(report.node.source.start).to.eql(locations[path].start);
}
if (locations[path].word !== null) {
chai_1.expect(report.options.word).to.eql(locations[path].word);
(0, chai_1.expect)(report.options.word).to.eql(locations[path].word);
}
if (expectedWarning.severity) {
chai_1.expect(report.type, `diagnostics severity mismatch, expected ${expectedWarning.severity} but received ${report.type}`).to.equal(expectedWarning.severity);
(0, chai_1.expect)(report.type, `diagnostics severity mismatch, expected ${expectedWarning.severity} but received ${report.type}`).to.equal(expectedWarning.severity);
}
}
chai_1.expect(expectedWarnings.length, `expected diagnostics: ${JSON.stringify(expectedWarnings.map((d) => d.message), null, 2)}, but received ${JSON.stringify(warningMessages, null, 2)}`).to.equal(diagnostics.reports.length);
(0, chai_1.expect)(expectedWarnings.length, `expected diagnostics: ${JSON.stringify(expectedWarnings.map((d) => d.message), null, 2)}, but received ${JSON.stringify(warningMessages, null, 2)}`).to.equal(diagnostics.reports.length);
return result;

@@ -111,6 +111,6 @@ }

const processReports = meta.diagnostics.reports;
chai_1.expect(processReports.length, `processing diagnostics: ${processReports.map((r) => r.message)}`).to.equal(0);
(0, chai_1.expect)(processReports.length, `processing diagnostics: ${processReports.map((r) => r.message)}`).to.equal(0);
if (meta.transformDiagnostics && checkTransformDiagnostics) {
const transformerReports = meta.transformDiagnostics.reports;
chai_1.expect(transformerReports.length, `transforming diagnostics: ${transformerReports.map((r) => r.message)}`).to.equal(0);
(0, chai_1.expect)(transformerReports.length, `transforming diagnostics: ${transformerReports.map((r) => r.message)}`).to.equal(0);
}

@@ -117,0 +117,0 @@ }

@@ -27,4 +27,4 @@ "use strict";

function generateInfra(config, diagnostics = new core_1.Diagnostics()) {
const { fs, requireModule } = core_1.createMinimalFS(config);
const { fileProcessor } = core_1.createInfrastructure('/', fs, (meta, filePath) => {
const { fs, requireModule } = (0, core_1.createMinimalFS)(config);
const { fileProcessor } = (0, core_1.createInfrastructure)('/', fs, (meta, filePath) => {
meta.namespace = config.files[filePath].namespace || meta.namespace;

@@ -51,3 +51,3 @@ return meta;

function processSource(source, options = {}, resolveNamespace) {
return core_1.process(postcss.parse(source, options), undefined, resolveNamespace);
return (0, core_1.process)(postcss.parse(source, options), undefined, resolveNamespace);
}

@@ -61,3 +61,3 @@ exports.processSource = processSource;

const { entry } = config;
if (!path_1.isAbsolute(entry || '')) {
if (!(0, path_1.isAbsolute)(entry || '')) {
throw new Error(`entry must be absolute path got: ${entry}`);

@@ -64,0 +64,0 @@ }

@@ -1,8 +0,8 @@

export * from './diagnostics';
export * from './generate-test-util';
export * from './matchers/flat-match';
export * from './matchers/match-css';
export * from './matchers/results';
export * from './match-rules';
export * from './inline-expectation';
export { Diagnostic, expectWarnings, expectWarningsFromTransform, findTestLocations, shouldReportNoDiagnostics, } from './diagnostics';
export { Config, File, InfraConfig, RequireType, createProcess, createTransformer, generateInfra, generateStylableExports, generateStylableResult, generateStylableRoot, processSource, } from './generate-test-util';
export { flatMatch } from './matchers/flat-match';
export { matchCSSMatchers } from './matchers/match-css';
export { mediaQuery, styleRules } from './matchers/results';
export { matchAllRulesAndDeclarations, matchRuleAndDeclaration } from './match-rules';
export { testInlineExpects, testInlineExpectsErrors } from './inline-expectation';
//# sourceMappingURL=index.d.ts.map
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./diagnostics"), exports);
__exportStar(require("./generate-test-util"), exports);
__exportStar(require("./matchers/flat-match"), exports);
__exportStar(require("./matchers/match-css"), exports);
__exportStar(require("./matchers/results"), exports);
__exportStar(require("./match-rules"), exports);
__exportStar(require("./inline-expectation"), exports);
exports.testInlineExpectsErrors = exports.testInlineExpects = exports.matchRuleAndDeclaration = exports.matchAllRulesAndDeclarations = exports.styleRules = exports.mediaQuery = exports.matchCSSMatchers = exports.flatMatch = exports.processSource = exports.generateStylableRoot = exports.generateStylableResult = exports.generateStylableExports = exports.generateInfra = exports.createTransformer = exports.createProcess = exports.shouldReportNoDiagnostics = exports.findTestLocations = exports.expectWarningsFromTransform = exports.expectWarnings = void 0;
var diagnostics_1 = require("./diagnostics");
Object.defineProperty(exports, "expectWarnings", { enumerable: true, get: function () { return diagnostics_1.expectWarnings; } });
Object.defineProperty(exports, "expectWarningsFromTransform", { enumerable: true, get: function () { return diagnostics_1.expectWarningsFromTransform; } });
Object.defineProperty(exports, "findTestLocations", { enumerable: true, get: function () { return diagnostics_1.findTestLocations; } });
Object.defineProperty(exports, "shouldReportNoDiagnostics", { enumerable: true, get: function () { return diagnostics_1.shouldReportNoDiagnostics; } });
var generate_test_util_1 = require("./generate-test-util");
Object.defineProperty(exports, "createProcess", { enumerable: true, get: function () { return generate_test_util_1.createProcess; } });
Object.defineProperty(exports, "createTransformer", { enumerable: true, get: function () { return generate_test_util_1.createTransformer; } });
Object.defineProperty(exports, "generateInfra", { enumerable: true, get: function () { return generate_test_util_1.generateInfra; } });
Object.defineProperty(exports, "generateStylableExports", { enumerable: true, get: function () { return generate_test_util_1.generateStylableExports; } });
Object.defineProperty(exports, "generateStylableResult", { enumerable: true, get: function () { return generate_test_util_1.generateStylableResult; } });
Object.defineProperty(exports, "generateStylableRoot", { enumerable: true, get: function () { return generate_test_util_1.generateStylableRoot; } });
Object.defineProperty(exports, "processSource", { enumerable: true, get: function () { return generate_test_util_1.processSource; } });
var flat_match_1 = require("./matchers/flat-match");
Object.defineProperty(exports, "flatMatch", { enumerable: true, get: function () { return flat_match_1.flatMatch; } });
var match_css_1 = require("./matchers/match-css");
Object.defineProperty(exports, "matchCSSMatchers", { enumerable: true, get: function () { return match_css_1.matchCSSMatchers; } });
var results_1 = require("./matchers/results");
Object.defineProperty(exports, "mediaQuery", { enumerable: true, get: function () { return results_1.mediaQuery; } });
Object.defineProperty(exports, "styleRules", { enumerable: true, get: function () { return results_1.styleRules; } });
var match_rules_1 = require("./match-rules");
Object.defineProperty(exports, "matchAllRulesAndDeclarations", { enumerable: true, get: function () { return match_rules_1.matchAllRulesAndDeclarations; } });
Object.defineProperty(exports, "matchRuleAndDeclaration", { enumerable: true, get: function () { return match_rules_1.matchRuleAndDeclaration; } });
var inline_expectation_1 = require("./inline-expectation");
Object.defineProperty(exports, "testInlineExpects", { enumerable: true, get: function () { return inline_expectation_1.testInlineExpects; } });
Object.defineProperty(exports, "testInlineExpectsErrors", { enumerable: true, get: function () { return inline_expectation_1.testInlineExpectsErrors; } });
//# sourceMappingURL=index.js.map

@@ -12,3 +12,3 @@ "use strict";

chai.Assertion.addMethod('flatMatch', function (obj, maxDepth = 5) {
chai_1.expect(flat_1.default(flag(this, 'object'), { maxDepth })).to.contain(flat_1.default(obj));
(0, chai_1.expect)((0, flat_1.default)(flag(this, 'object'), { maxDepth })).to.contain((0, flat_1.default)(obj));
});

@@ -15,0 +15,0 @@ }

@@ -16,4 +16,4 @@ "use strict";

// TODO: better reporting.
chai_1.expect(element.length).to.equal(css.length);
css.forEach((chunk, index) => chai_1.expect(element[index]).to.eql(chunk));
(0, chai_1.expect)(element.length).to.equal(css.length);
css.forEach((chunk, index) => (0, chai_1.expect)(element[index]).to.eql(chunk));
});

@@ -20,0 +20,0 @@ }

@@ -49,3 +49,3 @@ "use strict";

const actualRule = rule.toString();
chai_1.expect(actualRule, `rule #${index}`).to.equal(nextExpectedRule);
(0, chai_1.expect)(actualRule, `rule #${index}`).to.equal(nextExpectedRule);
});

@@ -56,4 +56,4 @@ }

for (const expectedIndex in styleRules) {
chai_1.expect(nodes, `rules exist`).to.not.equal(undefined);
chai_1.expect(nodes && nodes[expectedIndex].toString()).to.equal(styleRules[expectedIndex]);
(0, chai_1.expect)(nodes, `rules exist`).to.not.equal(undefined);
(0, chai_1.expect)(nodes && nodes[expectedIndex].toString()).to.equal(styleRules[expectedIndex]);
}

@@ -60,0 +60,0 @@ }

{
"name": "@stylable/core-test-kit",
"version": "4.6.0",
"version": "4.7.0",
"description": "Stylable core test-kit",

@@ -10,6 +10,6 @@ "main": "dist/index.js",

"dependencies": {
"@stylable/core": "^4.6.0",
"@stylable/core": "^4.7.0",
"chai": "^4.3.4",
"flat": "^5.0.2",
"postcss": "^8.3.6"
"postcss": "^8.3.8"
},

@@ -16,0 +16,0 @@ "files": [

import { expect } from 'chai';
import deindent from 'deindent';
import type { Position } from 'postcss';
import { Diagnostics, process, safeParse, StylableMeta, StylableResults } from '@stylable/core';
import {
Diagnostics,
DiagnosticType,
process,
safeParse,
StylableMeta,
StylableResults,
} from '@stylable/core';
import { Config, generateStylableResult } from './generate-test-util';
export interface Diagnostic {
severity?: 'warning' | 'error';
severity?: DiagnosticType;
message: string;

@@ -10,0 +17,0 @@ file: string;

@@ -1,7 +0,25 @@

export * from './diagnostics';
export * from './generate-test-util';
export * from './matchers/flat-match';
export * from './matchers/match-css';
export * from './matchers/results';
export * from './match-rules';
export * from './inline-expectation';
export {
Diagnostic,
expectWarnings,
expectWarningsFromTransform,
findTestLocations,
shouldReportNoDiagnostics,
} from './diagnostics';
export {
Config,
File,
InfraConfig,
RequireType,
createProcess,
createTransformer,
generateInfra,
generateStylableExports,
generateStylableResult,
generateStylableRoot,
processSource,
} from './generate-test-util';
export { flatMatch } from './matchers/flat-match';
export { matchCSSMatchers } from './matchers/match-css';
export { mediaQuery, styleRules } from './matchers/results';
export { matchAllRulesAndDeclarations, matchRuleAndDeclaration } from './match-rules';
export { testInlineExpects, testInlineExpectsErrors } from './inline-expectation';

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

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