Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dacurse/aoc
My solutions to Advent of Code.
https://github.com/dacurse/aoc
advent-of-code javascript jest nodejs
Last synced: about 1 month ago
JSON representation
My solutions to Advent of Code.
- Host: GitHub
- URL: https://github.com/dacurse/aoc
- Owner: DaCurse
- License: gpl-3.0
- Created: 2020-12-01T09:42:11.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2020-12-08T19:29:34.000Z (about 4 years ago)
- Last Synced: 2024-11-07T20:40:59.750Z (3 months ago)
- Topics: advent-of-code, javascript, jest, nodejs
- Language: JavaScript
- Homepage:
- Size: 143 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Advent of Code
[![Travis (.com)](https://img.shields.io/travis/com/DaCurse/AoC?label=tests)](https://travis-ci.com/DaCurse/AoC)
My solutions to [AoC](https://adventofcode.com/), organized to folders for each year.
- [Advent of Code](#advent-of-code)
- [Getting Started](#getting-started)
- [Inputs](#inputs)
- [Running](#running)
- [Install dependencies](#install-dependencies)
- [Running all tests](#running-all-tests)
- [Running tests for specific year](#running-tests-for-specific-year)
- [Running specific test](#running-specific-test)
- [Updating snapshots](#updating-snapshots)## Getting Started
### Inputs
Inputs need to be provided in the [inputs](/inputs) directory, with a directory for the year and a file for each day with the name being `{day}.txt`. Example directory strucure:
```
inputs/
`-- 2020
`-- 01.txt
```If an input for a test does not exist, it will try to download it from the AoC website which requires being authorized. You can provide a session token (found in your cookies on https://adventofcode.com/) by creating a `.env` file in the root directory with the contents:
```
AOC_SESSION={YOUR SESSION TOKEN}
```Or by setting the `AOC_SESSION` environment variable.
### Running
#### Install dependencies
```sh
# with yarn
yarn
# with npm
npm i
```#### Running all tests
```sh
# with yarn
yarn start
# with npm
npm start
```#### Running tests for specific year
```sh
yarn start 2020
# OR
yarn start {year}
```#### Running specific test
```sh
yarn start 2020/aoc01
# OR
yarn start {year}/aoc{day}
```#### Updating snapshots
Some tests use [snapshots](https://jestjs.io/docs/en/snapshot-testing) which compare the result to one stored in a snapshot file. You might want to update the snapshot when using different inputs.
```sh
yarn start --updateSnapshot
```