Skip to content

Commit

Permalink
Use feature branches for testing the JS API (#1853)
Browse files Browse the repository at this point in the history
This also skips a few color tests for the embedded host
  • Loading branch information
nex3 committed Dec 14, 2022
1 parent 7ddb751 commit 017ff98
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 53 deletions.
58 changes: 27 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,15 @@ jobs:
- uses: dart-lang/setup-dart@v1
with: {sdk: "${{ matrix.dart_channel }}"}

- name: Install dart-sass
run: |
GITHUB_REF=${PR_REF:-$CURRENT_REF}
if [[ "$GITHUB_REF" == refs/heads/feature.* ]]; then branch="${GITHUB_REF:11}"; else branch=main; fi
git clone https://github.com/sass/dart-sass.git ../dart-sass --depth 1 --branch "$branch"
(cd ../dart-sass; dart pub get)
env:
PR_REF: "${{ github.base_ref }}"
CURRENT_REF: "${{ github.ref }}"
- name: Dart Sass | Checkout
uses: sass/clone-linked-repo@v1
with: {repo: sass/dart-sass, path: dart-sass}
- name: Dart Sass | dart pub get
run: dart pub get
working-directory: dart-sass

- name: Run specs
run: npm run sass-spec -- --dart ../dart-sass
run: npm run sass-spec -- --dart dart-sass

libsass:
name: "Language | LibSass"
Expand All @@ -88,7 +85,7 @@ jobs:
with: {node-version: "${{ env.NODE_VERSION }}"}
- run: npm install

- name: Install sassc
- name: Install SassC
run: |
export SASS_LIBSASS_PATH=$BUILD_DIR/../libsass
export SASS_SASSC_PATH=$BUILD_DIR/../sassc
Expand Down Expand Up @@ -131,16 +128,16 @@ jobs:
- uses: dart-lang/setup-dart@v1
with: {sdk: stable}

- name: Install Dart Sass
- name: Dart Sass | Checkout
uses: sass/clone-linked-repo@v1
with: {repo: sass/dart-sass, path: dart-sass}
- name: Dart Sass | Install
run: |
git clone https://github.com/sass/dart-sass.git ../dart-sass --depth 1
(
cd ../dart-sass
dart pub get
dart pub run grinder pkg-npm-dev
cd build/npm
npm install
)
dart pub get
dart pub run grinder pkg-npm-dev
cd build/npm
npm install
working-directory: dart-sass

- name: Check out Sass specification
uses: sass/clone-linked-repo@v1
Expand All @@ -149,7 +146,7 @@ jobs:
path: language

- name: Run specs
run: npm run js-api-spec -- --sassPackage ../dart-sass/build/npm --sassSassRepo language
run: npm run js-api-spec -- --sassPackage dart-sass/build/npm --sassSassRepo language

# The versions should be kept up-to-date with the latest LTS Node releases.
# They next need to be rotated October 2021. See
Expand Down Expand Up @@ -186,16 +183,15 @@ jobs:
version: ${{ env.PROTOC_VERSION }}
repo-token: '${{ github.token }}'

- name: Install sass-embedded
- name: Node.js Embedded Host | Checkout
uses: sass/clone-linked-repo@v1
with: {repo: sass/embedded-host-node, path: embedded-host-node}
- name: Node.js Embedded Host | Install
run: |
git clone https://github.com/sass/embedded-host-node.git \
../embedded-host-node --depth 1
(
cd ../embedded-host-node
npm install
npm run init
npm run compile
)
npm install
npm run init
npm run compile
working-directory: embedded-host-node

- name: Check out Sass specification
uses: sass/clone-linked-repo@v1
Expand All @@ -204,4 +200,4 @@ jobs:
path: language

- name: Run specs
run: npm run js-api-spec -- --sassPackage ../embedded-host-node --sassSassRepo language
run: npm run js-api-spec -- --sassPackage embedded-host-node --sassSassRepo language
58 changes: 36 additions & 22 deletions js-api-spec/value/color.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import {Value, SassColor} from 'sass';

import '../utils';
import {skipForImpl} from '../utils';

/** A utility function for creating an RGB color. */
function rgb(
Expand Down Expand Up @@ -178,10 +178,13 @@ describe('SassColor', () => {
expect(color.lightness).toBe(42);
});

it('has HWB channels', () => {
expect(color.hue).toBe(120);
expect(color.whiteness).toBe(24.360000000000003);
expect(color.blackness).toBe(40.36000000000001);
// sass/embedded-host-node#170
skipForImpl('sass-embedded', () => {
it('has HWB channels', () => {
expect(color.hue).toBe(120);
expect(color.whiteness).toBe(24.360000000000003);
expect(color.blackness).toBe(40.36000000000001);
});
});

it('has an alpha channel', () => {
Expand Down Expand Up @@ -215,16 +218,22 @@ describe('SassColor', () => {
expect(color.blue).toBe(107);
});

it('has HSL channels', () => {
expect(color.hue).toBe(120);
expect(color.saturation).toBe(16.000000000000007);
expect(color.lightness).toBe(50);
// sass/embedded-host-node#170
skipForImpl('sass-embedded', () => {
it('has HSL channels', () => {
expect(color.hue).toBe(120);
expect(color.saturation).toBe(16.000000000000007);
expect(color.lightness).toBe(50);
});
});

it('has HWB channels', () => {
expect(color.hue).toBe(120);
expect(color.whiteness).toBe(42);
expect(color.blackness).toBe(42);
// sass/embedded-host-node#170
skipForImpl('sass-embedded', () => {
it('has HWB channels', () => {
expect(color.hue).toBe(120);
expect(color.whiteness).toBe(42);
expect(color.blackness).toBe(42);
});
});

it('has an alpha channel', () => {
Expand Down Expand Up @@ -375,15 +384,20 @@ describe('SassColor', () => {
).toEqualWithHash(hwb(120, 42, 42, 0.5));
});

it('allows valid values', () => {
expect(color.change({whiteness: 0}).whiteness).toBe(0);
expect(color.change({whiteness: 100}).whiteness).toBe(
60.141509433962256
);
expect(color.change({blackness: 0}).blackness).toBe(0);
expect(color.change({blackness: 100}).blackness).toBe(93.4065934065934);
expect(color.change({alpha: 0}).alpha).toBe(0);
expect(color.change({alpha: 1}).alpha).toBe(1);
// sass/embedded-host-node#170
skipForImpl('sass-embedded', () => {
it('allows valid values', () => {
expect(color.change({whiteness: 0}).whiteness).toBe(0);
expect(color.change({whiteness: 100}).whiteness).toBe(
60.141509433962256
);
expect(color.change({blackness: 0}).blackness).toBe(0);
expect(color.change({blackness: 100}).blackness).toBe(
93.4065934065934
);
expect(color.change({alpha: 0}).alpha).toBe(0);
expect(color.change({alpha: 1}).alpha).toBe(1);
});
});

it('disallows invalid values', () => {
Expand Down

0 comments on commit 017ff98

Please sign in to comment.