@enigmatry/scss-foundation 20.3.1-preview.1 → 21.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <coverage generated="1762771250175" clover="3.2.0">
3
- <project timestamp="1762771250175" name="All files">
2
+ <coverage generated="1776338501160" clover="3.2.0">
3
+ <project timestamp="1776338501160" name="All files">
4
4
  <metrics statements="0" coveredstatements="0" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0" elements="0" coveredelements="0" complexity="0" loc="0" ncloc="0" packages="0" files="0" classes="0"/>
5
5
  </project>
6
6
  </coverage>
@@ -86,7 +86,7 @@
86
86
  <div class='footer quiet pad2 space-top1 center small'>
87
87
  Code coverage generated by
88
88
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
89
- at 2025-11-10T10:40:50.173Z
89
+ at 2026-04-16T11:21:41.157Z
90
90
  </div>
91
91
  <script src="prettify.js"></script>
92
92
  <script>
@@ -0,0 +1,89 @@
1
+ 'use strict';
2
+
3
+ const vm = require('vm');
4
+ const { createContext } = vm;
5
+ const NodeEnvironment = require('jest-environment-node').default;
6
+ const { LegacyFakeTimers, ModernFakeTimers } = require('@jest/fake-timers');
7
+ const { ModuleMocker } = require('jest-mock');
8
+
9
+ /**
10
+ * Custom Jest 30 single-context environment.
11
+ *
12
+ * Replaces jest-environment-node-single-context (deprecated, max v29) to allow
13
+ * Dart-compiled Sass to run without V8 context isolation errors.
14
+ *
15
+ * Jest 30 uses vm.compileFunction with parsingContext (not Script.runInContext),
16
+ * so we patch vm.compileFunction to omit the parsingContext for registered single-contexts.
17
+ */
18
+
19
+ const singleContexts = new WeakSet();
20
+
21
+ // Patch Script.prototype.runInContext (fallback for any pre-Jest-30 paths)
22
+ const origRunInContext = vm.Script.prototype.runInContext;
23
+ vm.Script.prototype.runInContext = function (context, options) {
24
+ if (singleContexts.has(context)) {
25
+ return this.runInThisContext(options);
26
+ }
27
+ return origRunInContext.call(this, context, options);
28
+ };
29
+
30
+ // Patch vm.compileFunction (used by Jest 30) to run in main context for single-context envs
31
+ const origCompileFunction = vm.compileFunction;
32
+ vm.compileFunction = function (code, params, options) {
33
+ if (options && options.parsingContext && singleContexts.has(options.parsingContext)) {
34
+ const { parsingContext: _ignored, ...rest } = options;
35
+ return origCompileFunction(code, params, rest);
36
+ }
37
+ return origCompileFunction.apply(this, arguments);
38
+ };
39
+
40
+ const timerIdToRef = (id) => ({
41
+ id,
42
+ ref() { return this; },
43
+ unref() { return this; },
44
+ });
45
+ const timerRefToId = (timer) => timer?.id;
46
+
47
+ class SingleContextNodeEnvironment extends NodeEnvironment {
48
+ constructor(config, context) {
49
+ super(config, context);
50
+
51
+ this.global = global;
52
+ this.context = createContext(global);
53
+
54
+ if (this.context != null) {
55
+ singleContexts.add(this.context);
56
+ }
57
+
58
+ this.moduleMocker = new ModuleMocker(global);
59
+
60
+ this.fakeTimers = new LegacyFakeTimers({
61
+ config: config.projectConfig,
62
+ global,
63
+ moduleMocker: this.moduleMocker,
64
+ timerConfig: {
65
+ idToRef: timerIdToRef,
66
+ refToId: timerRefToId,
67
+ },
68
+ });
69
+
70
+ this.fakeTimersModern = new ModernFakeTimers({
71
+ config: config.projectConfig,
72
+ global,
73
+ });
74
+ }
75
+
76
+ async teardown() {
77
+ if (this.fakeTimers) {
78
+ this.fakeTimers.dispose();
79
+ }
80
+ if (this.fakeTimersModern) {
81
+ this.fakeTimersModern.dispose();
82
+ }
83
+ this.context = null;
84
+ this.fakeTimers = null;
85
+ this.fakeTimersModern = null;
86
+ }
87
+ }
88
+
89
+ module.exports = SingleContextNodeEnvironment;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enigmatry/scss-foundation",
3
- "version": "20.3.1-preview.1",
3
+ "version": "21.1.1",
4
4
  "author": "Enigmatry",
5
5
  "description": "Collection of SCSS utilities useful for the most of projects.",
6
6
  "homepage": "https://github.com/enigmatry/entry-angular-building-blocks/tree/master/libs/scss-foundation#readme",
@@ -16,7 +16,8 @@
16
16
  "test": "jest --coverage --colors"
17
17
  },
18
18
  "peerDependencies": {
19
- "sass-true": "7.0.0"
19
+ "sass-true": "10.1.0",
20
+ "sass": "1.99.0"
20
21
  },
21
22
  "publishConfig": {
22
23
  "access": "public"
@@ -1,6 +1,7 @@
1
1
  @mixin background-hover($regular-state, $hover-state) {
2
2
  background-color: $regular-state;
3
3
 
4
+ /* stylelint-disable-next-line nesting-selector-no-missing-scoping-root */
4
5
  &:hover, &:hover::before {
5
6
  background-color: $hover-state;
6
7
  }
@@ -1,6 +1,7 @@
1
1
  @mixin font-hover($regular-state, $hover-state) {
2
2
  color: $regular-state;
3
-
3
+
4
+ /* stylelint-disable-next-line nesting-selector-no-missing-scoping-root */
4
5
  &:hover, &:hover::before {
5
6
  color: $hover-state;
6
7
  }
@@ -1,14 +1,15 @@
1
1
  /**
2
- * @jest-environment jest-environment-node-single-context
2
+ * @jest-environment ./jest-environment-single-context
3
3
  */
4
4
 
5
5
  const path = require('path');
6
6
  const sassTrue = require('sass-true');
7
+ const sass = require('sass');
7
8
  const glob = require('glob');
8
9
 
9
10
  describe('Scss unit tests', () => {
10
11
  const paths = path.resolve(process.cwd(), 'tests/**/*.tests.scss').replace(/\\/g,'/');
11
12
  const sassTestFiles = glob.sync(paths);
12
13
 
13
- sassTestFiles.forEach(file => sassTrue.runSass({ describe, it }, file, {loadPaths: ['../../node_modules'] }));
14
+ sassTestFiles.forEach(file => sassTrue.runSass({ describe, it, sass }, file, {loadPaths: ['../../node_modules'] }));
14
15
  });
@@ -10,6 +10,7 @@
10
10
  @include true.expect() {
11
11
  background-color: #FFF;
12
12
 
13
+ /* stylelint-disable-next-line nesting-selector-no-missing-scoping-root */
13
14
  &:hover, &:hover::before {
14
15
  background-color: #CCC;
15
16
  }
@@ -10,6 +10,7 @@
10
10
  @include true.expect() {
11
11
  color: #000;
12
12
 
13
+ /* stylelint-disable-next-line nesting-selector-no-missing-scoping-root */
13
14
  &:hover, &:hover::before {
14
15
  color: #F00;
15
16
  }