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.10.3 to 4.10.4

6

dist/generate-test-util.js
"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]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k;

26

dist/inline-expectation.js

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

outputAst: result,
rawAst: null,
rawAst: result,
diagnostics: null,

@@ -63,4 +63,3 @@ transformDiagnostics: null,

: result;
// ToDo: support analyze mode
const rootAst = context.meta.outputAst;
const rootAst = context.meta.rawAst;
const expectedTestAmount = expectedTestInput !== null && expectedTestInput !== void 0 ? expectedTestInput : (((_a = rootAst.toString().match(new RegExp(`${testScopesRegex()}`, `gm`))) === null || _a === void 0 ? void 0 : _a.length) || 0);

@@ -72,6 +71,6 @@ const checks = [];

const input = comment.text.split(/@/gm);
const testCommentTarget = comment;
const testCommentSrc = isDeprecatedInput
const testCommentSrc = comment;
const testCommentTarget = isDeprecatedInput
? comment
: getSourceComment(context.meta, comment) || comment;
: getTargetComment(context.meta, comment) || comment;
const nodeTarget = testCommentTarget.next();

@@ -301,3 +300,3 @@ const nodeSrc = testCommentSrc.next();

};
const matchResult = expectation.match(/-(?<severity>\w+)(?<label>\([^)]*\))?\s?(?:word\((?<word>[^)]*)\))?\s?(?<message>.*)/);
const matchResult = expectation.match(/-(?<severity>\w+)(?<label>\([^)]*\))?\s?(?:word\((?<word>[^)]*)\))?\s?(?<message>[\s\S]*)/);
if (!matchResult) {

@@ -340,9 +339,12 @@ result.errors.push(exports.testInlineExpectsErrors.diagnosticsMalformed(type, expectation));

}
function getSourceComment(meta, { source }) {
function getTargetComment(meta, { source }) {
let match = undefined;
meta.rawAst.walkComments((srcComment) => {
if (!meta.outputAst) {
return;
}
meta.outputAst.walkComments((outputComment) => {
var _a, _b, _c, _d, _e, _f;
if (((_b = (_a = srcComment.source) === null || _a === void 0 ? void 0 : _a.start) === null || _b === void 0 ? void 0 : _b.offset) === ((_c = source === null || source === void 0 ? void 0 : source.start) === null || _c === void 0 ? void 0 : _c.offset) &&
((_e = (_d = srcComment.source) === null || _d === void 0 ? void 0 : _d.end) === null || _e === void 0 ? void 0 : _e.offset) === ((_f = source === null || source === void 0 ? void 0 : source.end) === null || _f === void 0 ? void 0 : _f.offset)) {
match = srcComment;
if (((_b = (_a = outputComment.source) === null || _a === void 0 ? void 0 : _a.start) === null || _b === void 0 ? void 0 : _b.offset) === ((_c = source === null || source === void 0 ? void 0 : source.start) === null || _c === void 0 ? void 0 : _c.offset) &&
((_e = (_d = outputComment.source) === null || _d === void 0 ? void 0 : _d.end) === null || _e === void 0 ? void 0 : _e.offset) === ((_f = source === null || source === void 0 ? void 0 : source.end) === null || _f === void 0 ? void 0 : _f.offset)) {
match = outputComment;
return false;

@@ -349,0 +351,0 @@ }

{
"name": "@stylable/core-test-kit",
"version": "4.10.3",
"version": "4.10.4",
"description": "Stylable core test-kit",

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

"@file-services/memory": "^5.7.1",
"@stylable/core": "^4.10.3",
"chai": "^4.3.4",
"@stylable/core": "^4.10.4",
"chai": "^4.3.6",
"flat": "^5.0.2",
"postcss": "^8.4.5"
"postcss": "^8.4.7"
},

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

@@ -69,3 +69,3 @@ import { matchDiagnostic } from './diagnostics';

outputAst: result,
rawAst: null as unknown as StylableMeta['rawAst'],
rawAst: result,
diagnostics: null as unknown as StylableMeta['diagnostics'],

@@ -76,4 +76,3 @@ transformDiagnostics: null as unknown as StylableMeta['transformDiagnostics'],

: result;
// ToDo: support analyze mode
const rootAst = context.meta.outputAst!;
const rootAst = context.meta.rawAst;
const expectedTestAmount =

@@ -87,6 +86,6 @@ expectedTestInput ??

const input = comment.text.split(/@/gm);
const testCommentTarget = comment;
const testCommentSrc = isDeprecatedInput
const testCommentSrc = comment;
const testCommentTarget = isDeprecatedInput
? comment
: getSourceComment(context.meta, comment) || comment;
: getTargetComment(context.meta, comment) || comment;
const nodeTarget = testCommentTarget.next() as AST;

@@ -383,3 +382,3 @@ const nodeSrc = testCommentSrc.next() as AST;

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

@@ -430,10 +429,13 @@ if (!matchResult) {

function getSourceComment(meta: Context['meta'], { source }: postcss.Comment) {
function getTargetComment(meta: Context['meta'], { source }: postcss.Comment) {
let match: postcss.Comment | undefined = undefined;
meta.rawAst.walkComments((srcComment) => {
if (!meta.outputAst) {
return;
}
meta.outputAst.walkComments((outputComment) => {
if (
srcComment.source?.start?.offset === source?.start?.offset &&
srcComment.source?.end?.offset === source?.end?.offset
outputComment.source?.start?.offset === source?.start?.offset &&
outputComment.source?.end?.offset === source?.end?.offset
) {
match = srcComment;
match = outputComment;
return false;

@@ -440,0 +442,0 @@ }

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