Skip to content

Commit

Permalink
Refactor CI workflow
Browse files Browse the repository at this point in the history
Should work with newest versions?
  • Loading branch information
nfrasser committed Nov 19, 2024
1 parent f60113c commit 137be85
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 50 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm install
- name: 'Setup tests'
run: bash test/setup.sh
- name: 'Run basic tests'
run: bash test/run.sh
- run: npm test

integration:
runs-on: ubuntu-latest
Expand All @@ -38,8 +35,15 @@ jobs:
- run: npm install
- name: 'Setup dist'
run: bash test/setup.sh --dist
- name: 'Run complete test suite'
run: bash test/run.sh --dist
- name: Run coverage
run: |
npm run build
npm run test:coverage
- name: Run browser tests
if: ${{ github.secret_source == 'Actions' }}
run: |
npm run copy
npm run test:ci
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
Expand Down
20 changes: 0 additions & 20 deletions test/run.sh

This file was deleted.

16 changes: 0 additions & 16 deletions test/setup.sh

This file was deleted.

16 changes: 8 additions & 8 deletions test/spec/linkify-react.test.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import ReactDOMServer from 'react-dom/server';
import { renderToStaticMarkup } from 'react-dom/server';
import * as linkify from 'linkifyjs';
import Linkify from 'linkify-react/src/linkify-react.mjs';
import mention from 'linkify-plugin-mention/src/mention.mjs';
Expand Down Expand Up @@ -53,7 +53,7 @@ describe('linkify-react', () => {
it('Works with default options', function () {
tests.map((test) => {
var linkified = React.createElement(Linkify, null, test[0]);
var result = ReactDOMServer.renderToStaticMarkup(linkified);
var result = renderToStaticMarkup(linkified);
expect(result).to.be.oneOf([test[1], `<span>${test[1]}</span>`]);
});
});
Expand All @@ -62,15 +62,15 @@ describe('linkify-react', () => {
tests.map((test) => {
var props = { options, as: 'div', className: 'lambda' };
var linkified = React.createElement(Linkify, props, test[0]);
var result = ReactDOMServer.renderToStaticMarkup(linkified);
var result = renderToStaticMarkup(linkified);
expect(result).to.be.eql(test[2]);
});
});

it('Finds links recursively', function () {
var strong = React.createElement('strong', null, 'https://facebook.github.io/react/');
var linkified = React.createElement(Linkify, null, 'A great site is google.com AND ', strong);
var result = ReactDOMServer.renderToStaticMarkup(linkified);
var result = renderToStaticMarkup(linkified);
var expected =
'A great site is <a href="http://google.com">google.com</a> AND <strong><a href="https://facebook.github.io/react/">https://facebook.github.io/react/</a></strong>';
expect(result).to.be.oneOf([expected, `<span>${expected}</span>`]);
Expand All @@ -85,7 +85,7 @@ describe('linkify-react', () => {

var delta = React.createElement(Delta);
var linkified = React.createElement(Linkify, null, 'A great site is google.com AND ', delta);
var result = ReactDOMServer.renderToStaticMarkup(linkified);
var result = renderToStaticMarkup(linkified);
var expected =
'A great site is <a href="http://google.com">google.com</a> AND <strong>https://facebook.github.io/react/</strong>';
expect(result).to.be.oneOf([expected, `<span>${expected}</span>`]);
Expand All @@ -97,7 +97,7 @@ describe('linkify-react', () => {
};
var em = React.createElement('em', null, 'https://facebook.github.io/react/');
var linkified = React.createElement(Linkify, { options }, 'A great site is google.com AND ', em);
var result = ReactDOMServer.renderToStaticMarkup(linkified);
var result = renderToStaticMarkup(linkified);
var expected =
'A great site is <a href="http://google.com">google.com</a> AND <em>https://facebook.github.io/react/</em>';
expect(result).to.be.oneOf([expected, `<span>${expected}</span>`]);
Expand All @@ -121,7 +121,7 @@ describe('linkify-react', () => {
'For the latest javascript.net\n',
React.createElement('strong', { key: 1 }, ['and also\n', '🥺👄.ws']),
);
const result = ReactDOMServer.renderToStaticMarkup(linkified);
const result = renderToStaticMarkup(linkified);
const expected = [
'hello<br/><br/>\t\t ',
'hello<br/><br/>\t\t',
Expand Down Expand Up @@ -155,7 +155,7 @@ describe('linkify-react', () => {
{ options },
'Check out linkify.js.org or contact @nfrasser',
);
const result = ReactDOMServer.renderToStaticMarkup(linkified);
const result = renderToStaticMarkup(linkified);
const expected =
'Check out <a href="http://linkify.js.org">linkify.js.org</a> or contact <span data-to="/users/nfrasser">@nfrasser</span>';
expect(result).to.be.oneOf([expected, `<span>${expected}</span>`]);
Expand Down

0 comments on commit 137be85

Please sign in to comment.