Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 65 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,68 @@
# Hermeto integration tests repository
# Yarnberry Regular Workflow Integration Test

This repository hosts the integration tests for our project. Each branch represents a different test
case. Please ignore README.md files in those branches at the moment. They might not be up to date.
This integration test is a regular workflow test for Yarnberry.
It does not use zero-installs feature - file `.pnp.cjs` and directory `.yarn/cache` are missing.

The branch names begin with a prefix indicating a package manager, followed by the
test case name in the format: `<package-manager>/<test-case>`.
## [Protocols](https://v3.yarnpkg.com/features/protocols)

To create a new test please create or request a new branch in GitHub UI first
and then open a PR against this branch. Alternatively, you can push an empty
branch first if you have push rights. Please avoid pushing non-empty branches
since that would hinder the visibility of changes made to this repository in
context of the main project repository.
- [x] Semver
- [ ] Tag
- [x] Npm alias
- [ ] ~~Git~~
- [ ] ~~GitHub~~
Comment on lines +11 to +12
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The PR's title and description state that this change is for testing git-resolved packages, but this checklist indicates that Git and GitHub protocols are not being tested. This is confusing. Since package.json includes dependencies from git repositories via HTTPS, I suggest updating this to reflect that.

Suggested change
- [ ] ~~Git~~
- [ ] ~~GitHub~~
- [x] Git
- [x] GitHub

- [x] File
- [x] Link
- [x] Patch
- [x] Portal
- [x] Workspace
- [ ] ~~Exec~~
- [x] Https

_Hermeto does not support the Git, GitHub and Exec protocols._

## [Pre|Post install scripts](https://yarnpkg.com/advanced/lifecycle-scripts)

```bash
"preinstall": "touch pwned-from-preinstall.txt",
"install": "touch pwned-from-install.txt",
"postinstall": "touch pwned-from-postinstall.txt"
```

See this [commit](https://github.com/hermetoproject/integration-tests/commit/646ba0d70bd7e08527985d70b663aa595800396c).

Arbitrary scripts are executed before and after `yarn install` command.

## Dependencies

- [x] dev dependencies
- [x] optional dependencies
- [x] peer dependencies
- [x] scoped dependencies
- [x] compiled dependencies

### Scoped dependencies

Starting with _@_.

```bash
"@types/node": "^20.4.5",
"@types/yargs": "^17",
```

### Optional dependencies

See this [commit](https://github.com/hermetoproject/integration-tests/commit/4326fbbde1b1770e752138a9347e13fcfaabc9be).

```bash
"fsevents": "^2.3.2", # only for MacOS
```

### Compiled dependencies

See this [commit](https://github.com/hermetoproject/integration-tests/commit/4066baa6ff91ce6d4491370479d8b8c23ed7dd37).

Let the container build to do the compilation, not Hermeto.

```bash
"tree-sitter-json": "^0.20.0",
```
20 changes: 20 additions & 0 deletions app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const yargs = require('yargs/yargs')
const { hideBin } = require('yargs/helpers')
const { format } = require('date-in-spanish') // fecha.format
const { answerMeTheseQuestionsThree } = require('old-man-from-scene-24')
const holyHandGrenade = require('holy-hand-grenade')
Comment on lines +1 to +5
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While using require works here, it's more idiomatic in TypeScript to use ES6-style import statements. This improves readability and allows for better static analysis and type checking, especially since tsconfig.json has esModuleInterop enabled.

Suggested change
const yargs = require('yargs/yargs')
const { hideBin } = require('yargs/helpers')
const { format } = require('date-in-spanish') // fecha.format
const { answerMeTheseQuestionsThree } = require('old-man-from-scene-24')
const holyHandGrenade = require('holy-hand-grenade')
import yargs from 'yargs/yargs';
import { hideBin } from 'yargs/helpers';
import { format } from 'date-in-spanish';
import { answerMeTheseQuestionsThree } from 'old-man-from-scene-24';
import holyHandGrenade from 'holy-hand-grenade';


const argv = yargs(hideBin(process.argv)).argv

const now = Date.now()

console.log(`Hello, ${argv.name ?? 'World'}!`)
console.log(`Today is ${format(now, 'dddd MMMM Do, YYYY')}`)

console.log()
for (let question of answerMeTheseQuestionsThree()) {
console.log(question)
}

console.log()
console.log(holyHandGrenade)
6 changes: 6 additions & 0 deletions book-of-armaments/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = `First shalt thou take out the Holy Pin.
Then shalt thou count to three, no more, no less.
Three shall be the number thou shalt count, and the number of the counting shall be three.
Four shalt thou not count, neither count thou two, excepting that thou then proceed to three.
Five is right out.
Once the number three, being the third number, be reached, then lobbest thou thy Holy Hand Grenade of Antioch towards thy foe, who, being naughty in My sight, shall snuff it.`
33 changes: 33 additions & 0 deletions external-packages/ansi-regex/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
export interface Options {
/**
Match only the first ANSI escape.

@default false
*/
readonly onlyFirst: boolean;
}

/**
Regular expression for matching ANSI escape codes.

@example
```
import ansiRegex from 'ansi-regex';

ansiRegex().test('\u001B[4mcake\u001B[0m');
//=> true

ansiRegex().test('cake');
//=> false

'\u001B[4mcake\u001B[0m'.match(ansiRegex());
//=> ['\u001B[4m', '\u001B[0m']

'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
//=> ['\u001B[4m']

'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
```
*/
export default function ansiRegex(options?: Options): RegExp;
8 changes: 8 additions & 0 deletions external-packages/ansi-regex/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default function ansiRegex({onlyFirst = false} = {}) {
const pattern = [
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
].join('|');

return new RegExp(pattern, onlyFirst ? undefined : 'g');
}
9 changes: 9 additions & 0 deletions external-packages/ansi-regex/license
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
58 changes: 58 additions & 0 deletions external-packages/ansi-regex/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"name": "ansi-regex",
"version": "6.0.1",
"description": "Regular expression for matching ANSI escape codes",
"license": "MIT",
"repository": "chalk/ansi-regex",
"funding": "https://github.com/chalk/ansi-regex?sponsor=1",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=12"
},
"scripts": {
"test": "xo && ava && tsd",
"view-supported": "node fixtures/view-codes.js"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"ansi",
"styles",
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"string",
"tty",
"escape",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"command-line",
"text",
"regex",
"regexp",
"re",
"match",
"test",
"find",
"pattern"
],
"devDependencies": {
"ava": "^3.15.0",
"tsd": "^0.14.0",
"xo": "^0.38.2"
}
}
72 changes: 72 additions & 0 deletions external-packages/ansi-regex/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# ansi-regex

> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code)

## Install

```
$ npm install ansi-regex
```

## Usage

```js
import ansiRegex from 'ansi-regex';

ansiRegex().test('\u001B[4mcake\u001B[0m');
//=> true

ansiRegex().test('cake');
//=> false

'\u001B[4mcake\u001B[0m'.match(ansiRegex());
//=> ['\u001B[4m', '\u001B[0m']

'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
//=> ['\u001B[4m']

'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
```

## API

### ansiRegex(options?)

Returns a regex for matching ANSI escape codes.

#### options

Type: `object`

##### onlyFirst

Type: `boolean`\
Default: `false` *(Matches any ANSI escape codes in a string)*

Match only the first ANSI escape.

## FAQ

### Why do you test for codes not in the ECMA 48 standard?

Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.

On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out.

## Maintainers

- [Sindre Sorhus](https://github.com/sindresorhus)
- [Josh Junon](https://github.com/qix-)

---

<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-ansi-regex?utm_source=npm-ansi-regex&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>
15 changes: 15 additions & 0 deletions external-packages/once/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
The ISC License

Copyright (c) Isaac Z. Schlueter and Contributors

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
79 changes: 79 additions & 0 deletions external-packages/once/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# once

Only call a function once.

## usage

```javascript
var once = require('once')

function load (file, cb) {
cb = once(cb)
loader.load('file')
loader.once('load', cb)
loader.once('error', cb)
}
```

Or add to the Function.prototype in a responsible way:

```javascript
// only has to be done once
require('once').proto()

function load (file, cb) {
cb = cb.once()
loader.load('file')
loader.once('load', cb)
loader.once('error', cb)
}
```

Ironically, the prototype feature makes this module twice as
complicated as necessary.

To check whether you function has been called, use `fn.called`. Once the
function is called for the first time the return value of the original
function is saved in `fn.value` and subsequent calls will continue to
return this value.

```javascript
var once = require('once')

function load (cb) {
cb = once(cb)
var stream = createStream()
stream.once('data', cb)
stream.once('end', function () {
if (!cb.called) cb(new Error('not found'))
})
}
```

## `once.strict(func)`

Throw an error if the function is called twice.

Some functions are expected to be called only once. Using `once` for them would
potentially hide logical errors.

In the example below, the `greet` function has to call the callback only once:

```javascript
function greet (name, cb) {
// return is missing from the if statement
// when no name is passed, the callback is called twice
if (!name) cb('Hello anonymous')
cb('Hello ' + name)
}

function log (msg) {
console.log(msg)
}

// this will print 'Hello anonymous' but the logical error will be missed
greet(null, once(msg))

// once.strict will print 'Hello anonymous' and throw an error when the callback will be called the second time
greet(null, once.strict(msg))
```
Loading