From a5132e10ca47fd592494a3b6ef8a854ba07930d3 Mon Sep 17 00:00:00 2001 From: notlee Date: Wed, 5 Aug 2020 11:49:38 +0100 Subject: [PATCH] True removed support for node-sass in v6. Relates to: https://github.com/Financial-Times/origami-build-tools/pull/856 --- lib/tasks/test-sass.js | 7 ++++--- package-lock.json | 9 +++++++++ package.json | 1 + .../test/scss/_mixins.test.scss | 14 ++++++++++++++ .../test/scss/index.test.scss | 5 +++++ .../test/scss/_mixins.test.scss | 14 ++++++++++++++ .../test/scss/index.test.scss | 5 +++++ 7 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 test/integration/test/fixtures/with-bower-dependency-installed/test/scss/_mixins.test.scss create mode 100644 test/integration/test/fixtures/with-bower-dependency-installed/test/scss/index.test.scss create mode 100644 test/integration/test/fixtures/with-npm-dependency-installed/test/scss/_mixins.test.scss create mode 100644 test/integration/test/fixtures/with-npm-dependency-installed/test/scss/index.test.scss diff --git a/lib/tasks/test-sass.js b/lib/tasks/test-sass.js index 67598c8c..ca9a9325 100644 --- a/lib/tasks/test-sass.js +++ b/lib/tasks/test-sass.js @@ -18,17 +18,18 @@ const trueTest = function(config, task) { const componentBase = path.join(__dirname, '../../'); const sassFile = path.join(__dirname, 'index.test.scss'); const sassTrue = require('${require.resolve("sass-true")}'); + const sass = require('${require.resolve("sass")}'); const getSassIncludePaths = ${files.getSassIncludePaths.toString()}; - const sass = '$system-code: "origami-build-tools";' + fs.readFileSync(sassFile); + const sassData = '$system-code: "origami-build-tools";' + fs.readFileSync(sassFile); sassTrue.runSass({ - data: sass, + data: sassData, // We use this to silence the sass console output when running "obt test". functions: {}, includePaths: [__dirname].concat(getSassIncludePaths(componentBase, ${JSON.stringify( config )})) }, { - describe, it + describe, it, sass }); ` ) diff --git a/package-lock.json b/package-lock.json index 5a0ab1c8..e1212e27 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9246,6 +9246,15 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "sass": { + "version": "1.26.10", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.26.10.tgz", + "integrity": "sha512-bzN0uvmzfsTvjz0qwccN1sPm2HxxpNI/Xa+7PlUEMS+nQvbyuEK7Y0qFqxlPHhiNHb1Ze8WQJtU31olMObkAMw==", + "dev": true, + "requires": { + "chokidar": ">=2.0.0 <4.0.0" + } + }, "sass-graph": { "version": "2.2.5", "resolved": "https://registry.npmjs.org/sass-graph/-/sass-graph-2.2.5.tgz", diff --git a/package.json b/package.json index e0aff661..6a238ae5 100644 --- a/package.json +++ b/package.json @@ -80,6 +80,7 @@ "node-version": "^2.0.0", "npm-prepublish": "^1.2.3", "rimraf": "^3.0.2", + "sass": "^1.26.10", "unique-temp-dir": "^1.0.0" }, "repository": { diff --git a/test/integration/test/fixtures/with-bower-dependency-installed/test/scss/_mixins.test.scss b/test/integration/test/fixtures/with-bower-dependency-installed/test/scss/_mixins.test.scss new file mode 100644 index 00000000..6d9af2a1 --- /dev/null +++ b/test/integration/test/fixtures/with-bower-dependency-installed/test/scss/_mixins.test.scss @@ -0,0 +1,14 @@ +@include test-module('oTestComponentHelloWorld') { + @include test('Can be included') { + @include assert { + @include output($selector: false) { + @include oTestComponentHelloWorld(); + } + @include expect($selector: false) { + body:after { + content: 'Hello world!'; + } + } + } + } +} diff --git a/test/integration/test/fixtures/with-bower-dependency-installed/test/scss/index.test.scss b/test/integration/test/fixtures/with-bower-dependency-installed/test/scss/index.test.scss new file mode 100644 index 00000000..ed9e9deb --- /dev/null +++ b/test/integration/test/fixtures/with-bower-dependency-installed/test/scss/index.test.scss @@ -0,0 +1,5 @@ +@import 'true'; + +@import '../../main'; + +@import 'mixins.test'; diff --git a/test/integration/test/fixtures/with-npm-dependency-installed/test/scss/_mixins.test.scss b/test/integration/test/fixtures/with-npm-dependency-installed/test/scss/_mixins.test.scss new file mode 100644 index 00000000..6d9af2a1 --- /dev/null +++ b/test/integration/test/fixtures/with-npm-dependency-installed/test/scss/_mixins.test.scss @@ -0,0 +1,14 @@ +@include test-module('oTestComponentHelloWorld') { + @include test('Can be included') { + @include assert { + @include output($selector: false) { + @include oTestComponentHelloWorld(); + } + @include expect($selector: false) { + body:after { + content: 'Hello world!'; + } + } + } + } +} diff --git a/test/integration/test/fixtures/with-npm-dependency-installed/test/scss/index.test.scss b/test/integration/test/fixtures/with-npm-dependency-installed/test/scss/index.test.scss new file mode 100644 index 00000000..ed9e9deb --- /dev/null +++ b/test/integration/test/fixtures/with-npm-dependency-installed/test/scss/index.test.scss @@ -0,0 +1,5 @@ +@import 'true'; + +@import '../../main'; + +@import 'mixins.test';