Skip to content

Commit

Permalink
chore: add windows unit test action (#3136)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Dyla <[email protected]>
  • Loading branch information
legendecas and dyladan authored Aug 12, 2022
1 parent 038df3f commit 2e23d74
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 4 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,46 @@ jobs:
- name: Report Coverage
run: npm run codecov
if: ${{ matrix.node_version == '14' }}
node-windows-tests:
strategy:
fail-fast: false
runs-on: windows-latest
env:
NPM_CONFIG_UNSAFE_PERM: true
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: '16'

- run: npm install -g npm@latest

- name: restore lerna
id: cache
uses: actions/cache@v3
with:
path: |
node_modules
package-lock.json
packages/*/node_modules
packages/*/package-lock.json
experimental/packages/*/node_modules
experimental/packages/*/package-lock.json
key: node-windows-tests-${{ runner.os }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }}

- name: Bootstrap
run: |
npm install --ignore-scripts
npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' --ignore @opentelemetry/selenium-tests
- name: Build 🔧
run: |
npm run compile
- name: Unit tests
run: npm run test
browser-tests:
runs-on: ubuntu-latest
container:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -725,14 +725,16 @@ describe('HttpInstrumentation', () => {
}
});

it("should have 1 ended span when request doesn't listening response", done => {
it("should have 1 ended client span when request doesn't listening response", done => {
// nock doesn't emit close event.
nock.cleanAll();
nock.enableNetConnect();
const req = http.request(`${protocol}://${hostname}/`);

const req = http.request(`${protocol}://${hostname}:${serverPort}/`);
req.on('close', () => {
const spans = memoryExporter.getFinishedSpans();
const [span] = spans;
const spans = memoryExporter.getFinishedSpans().filter(it => it.kind === SpanKind.CLIENT);
assert.strictEqual(spans.length, 1);
const [span] = spans;
assert.ok(Object.keys(span.attributes).length > 6);
done();
});
Expand Down

0 comments on commit 2e23d74

Please sign in to comment.