<commit_before>trigger:
  - main

# https://developercommunity.visualstudio.com/comments/949241/view.html
pr:
  branches:
    include:
      - "*"

pool:
  vmImage: "ubuntu-20.04"

# TODO we don't actually need this for karma or cypress tests
# but it let's us use a single job. No need to split up jobs yet
strategy:
  matrix:
    # EOL: 2023-04-30
    # sync with #node-version
    node_14_x:
      node_version: 14.x
    # EOL: 2024-04-30
    node_16_x:
      node_version: 16.x
    # EOL: 2025-04-30
    node_18_x:
      node_version: 18.x
    # Initial release: 2022-10-18
    # EOL: 2023-06-01
    #node_19_x:
    #  node_version: 19.x
    # Initial release: 2023-04-18
    # EOL: 2026-04-30
    #node_20_x:
    #  node_version: 20.x

steps:
  - task: NodeTool@0.200.0
    inputs:
      versionSpec: $(node_version)
    displayName: "Install Node.js"

  - script: |
      yarn install
    displayName: "Install packages"

  - script: |
      yarn format
      git diff --exit-code
    displayName: "Check format"

  - script: yarn lint
    displayName: "Lint code"

  - script: yarn test:types
    displayName: "Test types"

  - script: |
      yarn build
    displayName: "Build"

  - script: |
      npm pack
      mv dom-accessibility-api-*.tgz dom-accessibility-api.tgz
    displayName: "Create tarball"

  - publish: $(System.DefaultWorkingDirectory)/dom-accessibility-api.tgz
    displayName: "Publish tarball"
    artifact: dom-accessibility-api-node-$(node_version)

  - task: DownloadPipelineArtifact@2.198.0
    displayName: "Download tarball from main"
    inputs:
      artifact: dom-accessibility-api-node-$(node_version)
      path: $(Agent.TempDirectory)/artifacts-main
      source: specific
      # Otherwise green builds (with tasks that have `continueOnError`) are not considered.
      # We need `continueOnError` if we add a new matrix entry.
      allowPartiallySucceededBuilds: true
      pipeline: $(System.DefinitionId)
      project: $(System.TeamProject)
      runVersion: latestFromBranch
      runBranch: refs/heads/main
    # Needed if we introduce a new Node.js version
    continueOnError: true

  - script: |
      mkdir $(Agent.TempDirectory)/published-previous
      mkdir $(Agent.TempDirectory)/published-current
      tar xfz $(Agent.TempDirectory)/artifacts-main/dom-accessibility-api.tgz --directory $(Agent.TempDirectory)/published-previous
      tar xfz $(System.DefaultWorkingDirectory)/dom-accessibility-api.tgz --directory $(Agent.TempDirectory)/published-current
      # --no-index implies --exit-code
      # This task is informative only.
      # Diffs are almost always expected
      git --no-pager diff --color --no-index $(Agent.TempDirectory)/published-previous $(Agent.TempDirectory)/published-current || exit 0
    displayName: "Diff tarballs"

  - script: yarn start
    displayName: "kcd-rollup smoke tests of build"
    workingDirectory: tests/build/fixtures/kcd-rollup

  - script: yarn start
    displayName: "ava+ts-node smoke tests of build"
    workingDirectory: tests/build/fixtures/ava-ts-node

  - script: yarn start
    displayName: "ES modules in node smoke tests of build"
    workingDirectory: tests/build/fixtures/node-es-modules

  - script: yarn test:ci
    displayName: "Run jest tests"

  - task: PublishTestResults@2
    condition: succeededOrFailed()
    inputs:
      testRunner: JUnit
      testResultsFiles: "$(System.DefaultWorkingDirectory)/junit.xml"

  - task: PublishCodeCoverageResults@1
    inputs:
      codeCoverageTool: Cobertura
      failIfCoverageEmpty: true
      summaryFileLocation: "$(System.DefaultWorkingDirectory)/scripts/jest/coverage/*coverage.xml"

  - script: |
      yarn wpt:init
      tests/wpt/wpt make-hosts-file | sudo tee -a /etc/hosts
    displayName: "Prepare web-platform-test"

  - script: yarn test:wpt:jsdom
    displayName: "Run wpt tests in jsdom"

  - script: yarn test:wpt:browser
    displayName: "Run wpt tests in browser"
<commit_msg>chore(deps): bump publishcodecoverageresults to 1.200.0 (#859)<commit_after>trigger:
  - main

# https://developercommunity.visualstudio.com/comments/949241/view.html
pr:
  branches:
    include:
      - "*"

pool:
  vmImage: "ubuntu-20.04"

# TODO we don't actually need this for karma or cypress tests
# but it let's us use a single job. No need to split up jobs yet
strategy:
  matrix:
    # EOL: 2023-04-30
    # sync with #node-version
    node_14_x:
      node_version: 14.x
    # EOL: 2024-04-30
    node_16_x:
      node_version: 16.x
    # EOL: 2025-04-30
    node_18_x:
      node_version: 18.x
    # Initial release: 2022-10-18
    # EOL: 2023-06-01
    #node_19_x:
    #  node_version: 19.x
    # Initial release: 2023-04-18
    # EOL: 2026-04-30
    #node_20_x:
    #  node_version: 20.x

steps:
  - task: NodeTool@0.200.0
    inputs:
      versionSpec: $(node_version)
    displayName: "Install Node.js"

  - script: |
      yarn install
    displayName: "Install packages"

  - script: |
      yarn format
      git diff --exit-code
    displayName: "Check format"

  - script: yarn lint
    displayName: "Lint code"

  - script: yarn test:types
    displayName: "Test types"

  - script: |
      yarn build
    displayName: "Build"

  - script: |
      npm pack
      mv dom-accessibility-api-*.tgz dom-accessibility-api.tgz
    displayName: "Create tarball"

  - publish: $(System.DefaultWorkingDirectory)/dom-accessibility-api.tgz
    displayName: "Publish tarball"
    artifact: dom-accessibility-api-node-$(node_version)

  - task: DownloadPipelineArtifact@2.198.0
    displayName: "Download tarball from main"
    inputs:
      artifact: dom-accessibility-api-node-$(node_version)
      path: $(Agent.TempDirectory)/artifacts-main
      source: specific
      # Otherwise green builds (with tasks that have `continueOnError`) are not considered.
      # We need `continueOnError` if we add a new matrix entry.
      allowPartiallySucceededBuilds: true
      pipeline: $(System.DefinitionId)
      project: $(System.TeamProject)
      runVersion: latestFromBranch
      runBranch: refs/heads/main
    # Needed if we introduce a new Node.js version
    continueOnError: true

  - script: |
      mkdir $(Agent.TempDirectory)/published-previous
      mkdir $(Agent.TempDirectory)/published-current
      tar xfz $(Agent.TempDirectory)/artifacts-main/dom-accessibility-api.tgz --directory $(Agent.TempDirectory)/published-previous
      tar xfz $(System.DefaultWorkingDirectory)/dom-accessibility-api.tgz --directory $(Agent.TempDirectory)/published-current
      # --no-index implies --exit-code
      # This task is informative only.
      # Diffs are almost always expected
      git --no-pager diff --color --no-index $(Agent.TempDirectory)/published-previous $(Agent.TempDirectory)/published-current || exit 0
    displayName: "Diff tarballs"

  - script: yarn start
    displayName: "kcd-rollup smoke tests of build"
    workingDirectory: tests/build/fixtures/kcd-rollup

  - script: yarn start
    displayName: "ava+ts-node smoke tests of build"
    workingDirectory: tests/build/fixtures/ava-ts-node

  - script: yarn start
    displayName: "ES modules in node smoke tests of build"
    workingDirectory: tests/build/fixtures/node-es-modules

  - script: yarn test:ci
    displayName: "Run jest tests"

  - task: PublishTestResults@2
    condition: succeededOrFailed()
    inputs:
      testRunner: JUnit
      testResultsFiles: "$(System.DefaultWorkingDirectory)/junit.xml"

  - task: PublishCodeCoverageResults@1.200.0
    inputs:
      codeCoverageTool: Cobertura
      failIfCoverageEmpty: true
      summaryFileLocation: "$(System.DefaultWorkingDirectory)/scripts/jest/coverage/*coverage.xml"

  - script: |
      yarn wpt:init
      tests/wpt/wpt make-hosts-file | sudo tee -a /etc/hosts
    displayName: "Prepare web-platform-test"

  - script: yarn test:wpt:jsdom
    displayName: "Run wpt tests in jsdom"

  - script: yarn test:wpt:browser
    displayName: "Run wpt tests in browser"

{'fraction_non_alphanumeric': 0.10449818318506453, 'fraction_numerical': 0.02631249216890114, 'mean_word_length': 2.979062811565304, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '765120', 'n_tokens_mistral': 2741, 'n_tokens_neox': 2497, 'n_words': 633}